I am new at hibernate and need help implementing
the following.
Given a POJO model EntityModel, with attribute entityObject of type IEntity interface
Assume both EntityA and EntityB implements interface IEntity.
The mapping column in the table associated with EntityModel is
CDE_LOC.
Here is what I want to do:
1. If CDE_LOC value is in list (“'01','02','03','04','05','06','07','08','09','10'”) then EntityA is loaded
2. If CDE_LOC value is in list
("'S','T','U','V','W','X','Y','Z') then EntityB is loaded
Here is a pseudo code of what I have in mind.
<any name="entityObject" meta-type="string" id-type="integer" cascade="none" update="false" insert="false">
<meta-value class="EntityA" value in ("'01','02','03','04','05','06','07','08','09','10'") />
<meta-value class=" EntityB" value in ("'S','T','U','V','W','X','Y','Z'") />
<column name="CDE_LOC" />
</any>
As an alternative to the pseudo code above, could I repeat the same entity in multiple lines as shown below?
…
<any name=" entityObject " meta-type="string" id-type="integer" cascade="none" update="false" insert="false">
<meta-value class="EntityA" value = "01" />
<meta-value class="EntityA" value = "02" />
<meta-value class="EntityA" value = "03" />
....
<meta-value class="EntityB" value = "S" />
<meta-value class="EntityB" value = "T" />
<meta-value class="EntityB” value = "U" />
...
<column name="CDE_LOC" />
</any>
Please help.
|