-->
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.  [ 2 posts ] 
Author Message
 Post subject: basic question, using the same POJO in two different tables
PostPosted: Wed Aug 30, 2006 2:54 pm 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
Hi,

I would like to have two mapping files that use the same POJO:

<hibernate-mapping>
<class
name="Apple"
table="old_fruit"
>
....

and

<hibernate-mapping>
<class
name="Apple"
table="new_fruit"
>

The problem is that my HQL saves and queries act upon the object Apple and it seems it has no way of knowing which table to use--

How can I explicitly tell it which table to query from or save to?

Thanks, Jason


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 30, 2006 4:32 pm 
Newbie

Joined: Tue Jun 20, 2006 10:20 pm
Posts: 6
To my knowledge you can't. HQL queries on the POJO and only knows which table to access because of your mapping document. You would either have to change your mapping programatically, or what i would probably do is just extend my apple class ala...

public class oldApple extends Apple {
....
}

public class newApple extendsApple {
....
}

and make your calls on oldApple and newApple.


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