-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Store object retrieved via database view
PostPosted: Wed Dec 16, 2009 3:51 am 
Beginner
Beginner

Joined: Mon Aug 23, 2004 12:44 am
Posts: 25
I've got to persist an object of class A.

Class A has a lot (10+) many-to-one relationships to other classes.

Before persisting A I need to find out whether a particular instance of A already exists in the database.

If so, I need to update it, if not, I need to create a new instance.

Because the table to which A is mapped has a lot of rows (millions) and A has a lot of foreign keys to the relating tables I thought using a view to quickly retrieve an existing instance of A.

Questions are:
- Can I use the same class A and map it both directly to the table and to the view ?
- If not, I need to classes I guess, class A and class AView where AView is mapped to the view.
- How can I retrieve AView from the view and then update it so that the updates "appear" in the table class A is mapped to ? So I want to retrieve the object via the view, and update it via the table mapping.

Thanks,
EDH


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.