Hi Folks I have the following many-to-many Collection
Code:
<set
name="clIdClassification"
table="BUSINESSOBJECTSCLASSIF_BO"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>
<key
column="BO_ID_BUSINESSOBJECT"
/>
<many-to-many
class="de.grob.wps.domain.model.ClassificationBO"
column="CL_ID_CLASSIFICATION"
outer-join="auto"
/>
</set>
it refers to the following ClassificationBo Mapping:
Code:
<hibernate-mapping>
<class
name="de.grob.wps.domain.model.ClassificationBO"
table="CLASSIFICATIONS"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="idClassification"
column="ID_CLASSIFICATION"
type="big_decimal"
>
<generator class="de.grob.wps.dwarf.domainstore.hibernate.id.BigDecmialSequenceGenerator">
<param name="sequence">ID_CLASSIFICATIONS</param>
</generator>
</id>
<many-to-one
name="clIdClassification"
class="de.grob.wps.domain.model.ClassificationBO"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="CL_ID_CLASSIFICATION"
/>
<property
name="idEntryName"
type="big_decimal"
update="true"
insert="true"
column="ID_ENTRY_NAME"
/>
<property
name="internal"
type="big_decimal"
update="true"
insert="true"
column="INTERNAL"
/>
<property
name="shortcut"
type="java.lang.String"
update="true"
insert="true"
column="SHORTCUT"
/>
<property
name="sort"
type="big_decimal"
update="true"
insert="true"
column="SORT"
/>
<set
name="boIdBusinessObject"
table="BUSINESSOBJECTSCLASSIF_BO"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>
<key
column="CL_ID_CLASSIFICATION"
/>
<many-to-many
class="de.grob.wps.domain.model.BusinessObjectBO"
column="BO_ID_BUSINESSOBJECT"
outer-join="auto"
/>
</set>
<set
name="edIdBusinessObject"
table="BUSINESSOBJECTSCLASSIF_ED"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
>
<key
column="CL_ID_CLASSIFICATION"
/>
<many-to-many
class="de.grob.wps.domain.model.EdgeBO"
column="ED_ID_BUSINESSOBJECT"
outer-join="auto"
/>
</set>
<component
name="modificationInfo"
class="de.grob.wps.domain.model.ModificationInfo"
>
<property
name="deleted"
type="date"
update="true"
insert="true"
column="DELETED"
not-null="false"
/>
<property
name="deleter"
type="big_decimal"
update="true"
insert="true"
column="DELETER"
not-null="false"
/>
<property
name="changed"
type="date"
update="true"
insert="true"
column="CHANGED"
/>
<property
name="changer"
type="big_decimal"
update="true"
insert="true"
column="CHANGER"
not-null="false"
/>
<property
name="created"
type="date"
update="true"
insert="true"
column="CREATED"
not-null="true"
/>
<property
name="creator"
type="big_decimal"
update="true"
insert="true"
column="CREATOR"
not-null="true"
/>
</component>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-ClassificationBO.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
This leads to the following resulting SQL
Code:
Hibernate: select business0_.CL_ID_CLASSIFICATION as CL_ID_CL2___, business0_.BO_ID_BUSINESSOBJECT as BO_ID_BU1___, classifi1_.ID_CLASSIFICATION as ID_CLASSIFICATION0_, classifi1_.CL_ID_CLASSIFICATION as CL_ID_CL2_0_, classifi1_.ID_ENTRY_NAME as ID_ENTRY3_0_, classifi1_.INTERNAL as INTERNAL0_, classifi1_.SHORTCUT as SHORTCUT0_, classifi1_.SORT as SORT0_, classifi1_.DELETED as DELETED0_, classifi1_.DELETER as DELETER0_, classifi1_.CHANGED as CHANGED0_, classifi1_.CHANGER as CHANGER0_, classifi1_.CREATED as CREATED0_, classifi1_.CREATOR as CREATOR0_, classifi2_.ID_CLASSIFICATION as ID_CLASSIFICATION1_, classifi2_.CL_ID_CLASSIFICATION as CL_ID_CL2_1_, classifi2_.ID_ENTRY_NAME as ID_ENTRY3_1_, classifi2_.INTERNAL as INTERNAL1_, classifi2_.SHORTCUT as SHORTCUT1_, classifi2_.SORT as SORT1_, classifi2_.DELETED as DELETED1_, classifi2_.DELETER as DELETER1_, classifi2_.CHANGED as CHANGED1_, classifi2_.CHANGER as CHANGER1_, classifi2_.CREATED as CREATED1_, classifi2_.CREATOR as CREATOR1_ from BUSINESSOBJECTSCLASSIF_BO business0_ inner join CLASSIFICATIONS classifi1_ on business0_.CL_ID_CLASSIFICATION=classifi1_.ID_CLASSIFICATION left outer join CLASSIFICATIONS classifi2_ on classifi1_.CL_ID_CLASSIFICATION=classifi2_.ID_CLASSIFICATION where business0_.BO_ID_BUSINESSOBJECT=?
Hibernate: select classifi1_.ID_CLASSIFICATION as ID_CLASSIFICATION0_, classifi1_.CL_ID_CLASSIFICATION as CL_ID_CL2_0_, classifi1_.ID_ENTRY_NAME as ID_ENTRY3_0_, classifi1_.INTERNAL as INTERNAL0_, classifi1_.SHORTCUT as SHORTCUT0_, classifi1_.SORT as SORT0_, classifi1_.DELETED as DELETED0_, classifi1_.DELETER as DELETER0_, classifi1_.CHANGED as CHANGED0_, classifi1_.CHANGER as CHANGER0_, classifi1_.CREATED as CREATED0_, classifi1_.CREATOR as CREATOR0_, classifi0_.ID_CLASSIFICATION as ID_CLASSIFICATION1_, classifi0_.CL_ID_CLASSIFICATION as CL_ID_CL2_1_, classifi0_.ID_ENTRY_NAME as ID_ENTRY3_1_, classifi0_.INTERNAL as INTERNAL1_, classifi0_.SHORTCUT as SHORTCUT1_, classifi0_.SORT as SORT1_, classifi0_.DELETED as DELETED1_, classifi0_.DELETER as DELETER1_, classifi0_.CHANGED as CHANGED1_, classifi0_.CHANGER as CHANGER1_, classifi0_.CREATED as CREATED1_, classifi0_.CREATOR as CREATOR1_ from CLASSIFICATIONS classifi0_ left outer join CLASSIFICATIONS classifi1_ on classifi0_.CL_ID_CLASSIFICATION=classifi1_.ID_CLASSIFICATION where classifi0_.ID_CLASSIFICATION=?
Hibernate: select business0_.ED_ID_BUSINESSOBJECT as ED_ID_BU2___, business0_.CL_ID_CLASSIFICATION as CL_ID_CL1___, edgebo1_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT0_, edgebo1_.AMOUNT as AMOUNT0_, edgebo1_.BARCODE as BARCODE0_, edgebo1_.ED_ID_BUSINESSOBJECT_FROM as ED_ID_BU4_0_, edgebo1_.ED_ID_BUSINESSOBJECT_TO as ED_ID_BU5_0_, edgebo1_.ED_NUMBER as ED_NUMBER0_, edgebo1_.ID_CS as ID_CS0_, edgebo1_.ID_ENTRY_DESCRIPTION as ID_ENTRY8_0_, edgebo1_.ID_ENTRY_NAME as ID_ENTRY9_0_, edgebo1_.OWNER_LOCATION as OWNER_L10_0_, edgebo1_.SHORT_TEXT as SHORT_TEXT0_, edgebo1_.SORT as SORT0_, edgebo1_.DELETED as DELETED0_, edgebo1_.DELETER as DELETER0_, edgebo1_.CHANGED as CHANGED0_, edgebo1_.CHANGER as CHANGER0_, edgebo1_.CREATED as CREATED0_, edgebo1_.CREATOR as CREATOR0_, business2_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT1_, business2_.BARCODE as BARCODE1_, business2_.ID_CS as ID_CS1_, business2_.OWNER_LOCATION as OWNER_LO4_1_, business2_.SHORT_TEXT as SHORT_TEXT1_, business2_.DELETED as DELETED1_, business2_.DELETER as DELETER1_, business2_.CHANGED as CHANGED1_, business2_.CHANGER as CHANGER1_, business2_.CREATED as CREATED1_, business2_.CREATOR as CREATOR1_, business3_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT2_, business3_.BARCODE as BARCODE2_, business3_.ID_CS as ID_CS2_, business3_.OWNER_LOCATION as OWNER_LO4_2_, business3_.SHORT_TEXT as SHORT_TEXT2_, business3_.DELETED as DELETED2_, business3_.DELETER as DELETER2_, business3_.CHANGED as CHANGED2_, business3_.CHANGER as CHANGER2_, business3_.CREATED as CREATED2_, business3_.CREATOR as CREATOR2_ from BUSINESSOBJECTSCLASSIF_ED business0_ inner join EDGES edgebo1_ on business0_.ED_ID_BUSINESSOBJECT=edgebo1_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business2_ on edgebo1_.ED_ID_BUSINESSOBJECT_FROM=business2_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business3_ on edgebo1_.ED_ID_BUSINESSOBJECT_TO=business3_.ID_BUSINESSOBJECT where business0_.CL_ID_CLASSIFICATION=?
Hibernate: select business0_.ED_ID_BUSINESSOBJECT as ED_ID_BU2___, business0_.CL_ID_CLASSIFICATION as CL_ID_CL1___, edgebo1_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT0_, edgebo1_.AMOUNT as AMOUNT0_, edgebo1_.BARCODE as BARCODE0_, edgebo1_.ED_ID_BUSINESSOBJECT_FROM as ED_ID_BU4_0_, edgebo1_.ED_ID_BUSINESSOBJECT_TO as ED_ID_BU5_0_, edgebo1_.ED_NUMBER as ED_NUMBER0_, edgebo1_.ID_CS as ID_CS0_, edgebo1_.ID_ENTRY_DESCRIPTION as ID_ENTRY8_0_, edgebo1_.ID_ENTRY_NAME as ID_ENTRY9_0_, edgebo1_.OWNER_LOCATION as OWNER_L10_0_, edgebo1_.SHORT_TEXT as SHORT_TEXT0_, edgebo1_.SORT as SORT0_, edgebo1_.DELETED as DELETED0_, edgebo1_.DELETER as DELETER0_, edgebo1_.CHANGED as CHANGED0_, edgebo1_.CHANGER as CHANGER0_, edgebo1_.CREATED as CREATED0_, edgebo1_.CREATOR as CREATOR0_, business2_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT1_, business2_.BARCODE as BARCODE1_, business2_.ID_CS as ID_CS1_, business2_.OWNER_LOCATION as OWNER_LO4_1_, business2_.SHORT_TEXT as SHORT_TEXT1_, business2_.DELETED as DELETED1_, business2_.DELETER as DELETER1_, business2_.CHANGED as CHANGED1_, business2_.CHANGER as CHANGER1_, business2_.CREATED as CREATED1_, business2_.CREATOR as CREATOR1_, business3_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT2_, business3_.BARCODE as BARCODE2_, business3_.ID_CS as ID_CS2_, business3_.OWNER_LOCATION as OWNER_LO4_2_, business3_.SHORT_TEXT as SHORT_TEXT2_, business3_.DELETED as DELETED2_, business3_.DELETER as DELETER2_, business3_.CHANGED as CHANGED2_, business3_.CHANGER as CHANGER2_, business3_.CREATED as CREATED2_, business3_.CREATOR as CREATOR2_ from BUSINESSOBJECTSCLASSIF_ED business0_ inner join EDGES edgebo1_ on business0_.ED_ID_BUSINESSOBJECT=edgebo1_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business2_ on edgebo1_.ED_ID_BUSINESSOBJECT_FROM=business2_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business3_ on edgebo1_.ED_ID_BUSINESSOBJECT_TO=business3_.ID_BUSINESSOBJECT where business0_.CL_ID_CLASSIFICATION=?
Hibernate: select business0_.ED_ID_BUSINESSOBJECT as ED_ID_BU2___, business0_.CL_ID_CLASSIFICATION as CL_ID_CL1___, edgebo1_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT0_, edgebo1_.AMOUNT as AMOUNT0_, edgebo1_.BARCODE as BARCODE0_, edgebo1_.ED_ID_BUSINESSOBJECT_FROM as ED_ID_BU4_0_, edgebo1_.ED_ID_BUSINESSOBJECT_TO as ED_ID_BU5_0_, edgebo1_.ED_NUMBER as ED_NUMBER0_, edgebo1_.ID_CS as ID_CS0_, edgebo1_.ID_ENTRY_DESCRIPTION as ID_ENTRY8_0_, edgebo1_.ID_ENTRY_NAME as ID_ENTRY9_0_, edgebo1_.OWNER_LOCATION as OWNER_L10_0_, edgebo1_.SHORT_TEXT as SHORT_TEXT0_, edgebo1_.SORT as SORT0_, edgebo1_.DELETED as DELETED0_, edgebo1_.DELETER as DELETER0_, edgebo1_.CHANGED as CHANGED0_, edgebo1_.CHANGER as CHANGER0_, edgebo1_.CREATED as CREATED0_, edgebo1_.CREATOR as CREATOR0_, business2_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT1_, business2_.BARCODE as BARCODE1_, business2_.ID_CS as ID_CS1_, business2_.OWNER_LOCATION as OWNER_LO4_1_, business2_.SHORT_TEXT as SHORT_TEXT1_, business2_.DELETED as DELETED1_, business2_.DELETER as DELETER1_, business2_.CHANGED as CHANGED1_, business2_.CHANGER as CHANGER1_, business2_.CREATED as CREATED1_, business2_.CREATOR as CREATOR1_, business3_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT2_, business3_.BARCODE as BARCODE2_, business3_.ID_CS as ID_CS2_, business3_.OWNER_LOCATION as OWNER_LO4_2_, business3_.SHORT_TEXT as SHORT_TEXT2_, business3_.DELETED as DELETED2_, business3_.DELETER as DELETER2_, business3_.CHANGED as CHANGED2_, business3_.CHANGER as CHANGER2_, business3_.CREATED as CREATED2_, business3_.CREATOR as CREATOR2_ from BUSINESSOBJECTSCLASSIF_ED business0_ inner join EDGES edgebo1_ on business0_.ED_ID_BUSINESSOBJECT=edgebo1_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business2_ on edgebo1_.ED_ID_BUSINESSOBJECT_FROM=business2_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business3_ on edgebo1_.ED_ID_BUSINESSOBJECT_TO=business3_.ID_BUSINESSOBJECT where business0_.CL_ID_CLASSIFICATION=?
Hibernate: select business0_.ED_ID_BUSINESSOBJECT as ED_ID_BU2___, business0_.CL_ID_CLASSIFICATION as CL_ID_CL1___, edgebo1_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT0_, edgebo1_.AMOUNT as AMOUNT0_, edgebo1_.BARCODE as BARCODE0_, edgebo1_.ED_ID_BUSINESSOBJECT_FROM as ED_ID_BU4_0_, edgebo1_.ED_ID_BUSINESSOBJECT_TO as ED_ID_BU5_0_, edgebo1_.ED_NUMBER as ED_NUMBER0_, edgebo1_.ID_CS as ID_CS0_, edgebo1_.ID_ENTRY_DESCRIPTION as ID_ENTRY8_0_, edgebo1_.ID_ENTRY_NAME as ID_ENTRY9_0_, edgebo1_.OWNER_LOCATION as OWNER_L10_0_, edgebo1_.SHORT_TEXT as SHORT_TEXT0_, edgebo1_.SORT as SORT0_, edgebo1_.DELETED as DELETED0_, edgebo1_.DELETER as DELETER0_, edgebo1_.CHANGED as CHANGED0_, edgebo1_.CHANGER as CHANGER0_, edgebo1_.CREATED as CREATED0_, edgebo1_.CREATOR as CREATOR0_, business2_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT1_, business2_.BARCODE as BARCODE1_, business2_.ID_CS as ID_CS1_, business2_.OWNER_LOCATION as OWNER_LO4_1_, business2_.SHORT_TEXT as SHORT_TEXT1_, business2_.DELETED as DELETED1_, business2_.DELETER as DELETER1_, business2_.CHANGED as CHANGED1_, business2_.CHANGER as CHANGER1_, business2_.CREATED as CREATED1_, business2_.CREATOR as CREATOR1_, business3_.ID_BUSINESSOBJECT as ID_BUSINESSOBJECT2_, business3_.BARCODE as BARCODE2_, business3_.ID_CS as ID_CS2_, business3_.OWNER_LOCATION as OWNER_LO4_2_, business3_.SHORT_TEXT as SHORT_TEXT2_, business3_.DELETED as DELETED2_, business3_.DELETER as DELETER2_, business3_.CHANGED as CHANGED2_, business3_.CHANGER as CHANGER2_, business3_.CREATED as CREATED2_, business3_.CREATOR as CREATOR2_ from BUSINESSOBJECTSCLASSIF_ED business0_ inner join EDGES edgebo1_ on business0_.ED_ID_BUSINESSOBJECT=edgebo1_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business2_ on edgebo1_.ED_ID_BUSINESSOBJECT_FROM=business2_.ID_BUSINESSOBJECT left outer join BUSINESSOBJECTS business3_ on edgebo1_.ED_ID_BUSINESSOBJECT_TO=business3_.ID_BUSINESSOBJECT where business0_.CL_ID_CLASSIFICATION=?
Is everything wrong with my many-to-many mapping?
1000 of thx -> Toby
Toby
[/code]