-->
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: Problem with entity-name in HQL query
PostPosted: Mon Jun 04, 2007 9:57 am 
Newbie

Joined: Sun Mar 12, 2006 2:44 pm
Posts: 10
Hi,

I have class mapped twice to the separate tables.

Code:
<class table="IP_ADDRESS" name="IPAddress"> (...)
<class entity-name="forRange" table="IP_ADDRESS_FOR_RANGE" name="IPAddress"> (...)

They are used for different purposes and I would like to have an ability to make a query to ask only about the first cases, only about the second cases or about both cases together.

I noticed that: "from IPAddress ..." makes two SQL and returns both types. I can use "from forRange ..." to get only the second case.

But how can I get in a query (or criteria) object mapped only by the first mapping (without entity-name)?

I could use entity-name in both cases
Code:
<class entity-name="normalIPAddress" table="IP_ADDRESS" name="IPAddress"> (...)
<class entity-name="forRange" table="IP_ADDRESS_FOR_RANGE" name="IPAddress"> (...)

but then I'll have to change all mappings to reference to normalIPAddress (IPAddress is reported as unmapped) and I'll have a problem with the third case (asking about both cases together - I can't use "from IPAddress" anymore).

Can it be done in some easier way (Hibernate 3.1 or 3.2)?

Thanks for help
Marcin


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.