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