-->
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.  [ 3 posts ] 
Author Message
 Post subject: hibernate mapping to view and table problem
PostPosted: Mon Mar 03, 2008 2:09 am 
Newbie

Joined: Wed Oct 10, 2007 9:30 pm
Posts: 6
Hi,

Is there a way for using Hibernate to map a class to a view for query and to a table if doing update, delete and insert?

I tried to create two mappings and set the entity-name, however everytime I do a query based on the class it execute the same SQL twice. I cannot simply using entity-name in the Criteria since I have mapping table per subclass.

This is the kind of what i'm trying to do:

MyObject
|- insert (into table my_object)
|- delete (from table my_object)
|- update (table my_object)
|- select (from my_valid_object_view)



MySubclass extends MyObject
|- insert, delete, update, select (from my_subclass_table)

Thanks for any help beforehand


Top
 Profile  
 
 Post subject: Re: hibernate mapping to view and table problem
PostPosted: Thu May 22, 2008 4:52 am 
Newbie

Joined: Mon May 19, 2008 9:27 am
Posts: 8
Hello,

did you find any solution for your question? We have a similar problem and so i am interested


otnateos wrote:
Hi,

Is there a way for using Hibernate to map a class to a view for query and to a table if doing update, delete and insert?

I tried to create two mappings and set the entity-name, however everytime I do a query based on the class it execute the same SQL twice. I cannot simply using entity-name in the Criteria since I have mapping table per subclass.

This is the kind of what i'm trying to do:

MyObject
|- insert (into table my_object)
|- delete (from table my_object)
|- update (table my_object)
|- select (from my_valid_object_view)



MySubclass extends MyObject
|- insert, delete, update, select (from my_subclass_table)

Thanks for any help beforehand


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 22, 2008 5:03 am 
Newbie

Joined: Wed Oct 10, 2007 9:30 pm
Posts: 6
Hi there,

I ended up mapping the superclass to my view and create my own <sql-delete> statement

Code:
MyObject
   |- insert (into table my_valid_object_view)
   |- delete (from table my_object)
   |- update (table my_valid_object_view)
   |- select (from my_valid_object_view)


and by having cascade delete I have all the subclass working perfectly on delete.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.