Hi there
I'm struggeling to integrate a legacy system with hibernate. All ids are assigned, many composite. Problem is that 2.1 RC1 seems to ignore the length of the id of the referenced column in many-to-many relationships.
Case:
2 persistent classes, Item and AcademicGroup in a bidirectional relationship, both have assigned string ids of length 16. Xdoclet generates the following mapping, which looks ok to me:
Extraxt from class OaseAcademicGroup
Code:
.....
<id
name="id"
column="id"
type="string"
length="16"
>
<generator class="assigned">
</generator>
</id>
.....
<set
name="academicGroups"
table="item_academicgroup"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
order-by="academicgroup"
>
<key
column="item"
/>
<many-to-many
class="net.hardersen.sl.oase.model.OaseAcademicGroup"
column="academicgroup"
outer-join="auto"
/>
</set>
......
Extract from class OaseItem
Code:
.......
<id
name="ean"
column="ean"
type="string"
length="16"
>
<generator class="assigned">
</generator>
</id>
.......
<set
name="items"
table="item_academicgroup"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
order-by="item"
>
<key
column="academicgroup"
/>
<many-to-many
class="net.hardersen.sl.oase.model.OaseItem"
column="item"
outer-join="auto"
/>
</set>
......
The SchemaExport generates the base (item and academicgroup) tables fine, but in the item_academicgroup table it ignores the id length of 16, and makes the columns 255 in size. This makes MaxDB (SAP DB) pissed, as referencing columns have to be of the exact same type.
I can think of a few ways to get around this, such as not using SchemaExport, making the lenght of the id columns 255, but none are good. Any ideas?
Thanks a lot! Keep up the good work.
T