Hibernate version:
2.1.7
Mapping documents:
to be written ... ;)
Name and version of the database you are using:
Oracle 9iR2
Hi all,
today I've a question about the recommended mapping for the scenario, described as the following:
I have several tables in my database, all of them have a artificial key (Long)
which is in fact a kind of OID.
So records ids won't be unique per table, but per database instance!
Now I have a special "Object" Table, which should hold some administrative data, e.g.
creationTS
updateTS
creationUser
updateUser
State
deletedFlag
and so on ...
this is designed that way for special staticstic generation - anyway!
my question is, how to map these several unidirectional one-to-one relations properly? I've read the reference manual as well as "HiA",
but I'm still in doubt, whether the base class could have several one-to-one constrained mappings?
<class name="person" table="PERSON">
<id name="id" column="PERSON_ID">
<generator class="foreign">
<param name="property">employee</param>
</generator>
</id>
...
<one-to-one name="employee"
class="Employee"
constrained="true"/>
<one-to-one name="freelancer"
class="Freelancer"
constrained="true"/>
</class>
is something like the above possible and how would it be constrained?
because ...
a freelancer-primary-key is definately one key in person (could be constrained)
but a primary-key in person is either a key in employee or freelancer
getting confused about the backward constraint ...
any hints/ideas are welcome
Thx in advance
K:)
|