-->
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.  [ 5 posts ] 
Author Message
 Post subject: Multiple Updateable Mappings?
PostPosted: Tue Apr 25, 2006 3:38 pm 
Newbie

Joined: Tue Apr 25, 2006 3:13 pm
Posts: 2
Hi,

I am looking at the feasibility of moving a project from TopLink to Hibernate. We are using DB2 as the database. One of the limitations we have with TopLink is that it only supports one updateable mapping per table. Is Hibernate able to support multiple updateable mappings to the same table?

We can sort of workaround the limitation in TopLink because DB2 supports "simple" updateable views which allow us to create more than one mapping, but the solution doesn't feel good.

Thanks,
BraileTrail


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 2:20 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
If you can model the table using distinct Classes for each updatable chunk, then yes, no problem. If you want a single class to model the table, then you have to write an update "query" for each way of updating the table. For this, you need hiberante 3.1 or later, but it is reasonably comprehensive. When you save an object, the normal update is executed; to use one of the alternatives, you need to get the query, set the object as a parameter to the query, then execute it. It's no more complicated, it just requires a separate save method or what-have-you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 2:55 am 
Newbie

Joined: Tue Apr 25, 2006 3:13 pm
Posts: 2
Hi,

thanks for the reply.

tenwit wrote:
If you can model the table using distinct Classes for each updatable chunk, then yes, no problem.


Yes, that's exactly what I intended to do. So that is another big plus point for Hibernate.

tenwit wrote:
If you want a single class to model the table, then you have to write an update "query" for each way of updating the table. For this, you need hiberante 3.1 or later, but it is reasonably comprehensive. When you save an object, the normal update is executed; to use one of the alternatives, you need to get the query, set the object as a parameter to the query, then execute it. It's no more complicated, it just requires a separate save method or what-have-you.


That is not a option I had considered, but I will give some thought now. :-)

Thanks again,
BraileTrail


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 5:27 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
If you can model the table using distinct Classes for each updatable chunk, then yes, no problem. If you want a single class to model the table, then you have to write an update "query" for each way of updating the table. For this, you need hiberante 3.1 or later, but it is reasonably comprehensive. When you save an object, the normal update is executed; to use one of the alternatives, you need to get the query, set the object as a parameter to the query, then execute it. It's no more complicated, it just requires a separate save method or what-have-you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 5:29 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Heh, I just found a problem with Firefox's sessionsaver plugin :) Sorry for the repost, it wasn't me, it was my browser!


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

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.