Hi,
Is there any way to specify so that I can use different mappings for the same class. We have couple of mapping files, one contains the whole heirachy with collection of sets and the other one is just flat. Based on different scenario, can i specify one mapping file over the other.
In the below 2 mappings, Mapping 1 internally maps to a set whereas Mapping 2 is not. But these 2 mappings is for the same class.
Mapping 1:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.win.core.bo.cardio.CardioWorkout" table="CARDIO_WORKOUT">
<!--<jcs-cache usage="read-write"/>-->
<id name="id" column="WORKOUT_NR" type="long">
<generator class="sequence">
<param name="sequence">CARDIO_WORKOUT_SEQ</param>
</generator>
</id>
<property name="parentId" column="PERSON_NR" type="long"/>
<property name="date" column="WORKOUT_DATE" type="date"/>
<set name="activitySet" table="CARDIO_ACTIVITY" lazy="false" cascade="all" inverse="true"
where="IS_DELETED='N'"
order-by= "activity_nr asc">
<!--<jcs-cache usage="read-write"/>-->
<key column="WORKOUT_NR"/> <one-to-many class="com.win.core.bo.cardio.CardioActivity"/>
</set>
</class>
</hibernate-mapping>
Mapping2:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.win.core.bo.cardio.CardioWorkout" table="CARDIO_WORKOUT">
<id name="id" column="WORKOUT_NR" type="long">
<generator class="sequence">
<param name="sequence">CARDIO_WORKOUT_SEQ</param>
</generator>
</id>
<property name="parentId" column="PERSON_NR" type="long"/>
<property name="date" column="WORKOUT_DATE" type="date"/>
</class>
</hibernate-mapping>
Best Regards,
raghu
|