I have a many-to-many mapping that's causing me some problems. I'm mapping to a table that has a string id column.
Code:
<set name="watches" table="SVD_WATCH" inverse="true" >
<key column="ContentId"/>
<many-to-many class="com.avalon.seaview.domain.User" column="UserId" />
</set>
which maps to:
Code:
<class
name="com.avalon.seaview.domain.User"
table="SVD_SEAVIEWUSER"
>
<id name="userId" type="java.lang.String" column="UserId" length="20" unsaved-value="null" >
<generator class="assigned"/>
</id>
....
The mapping basically works except that the generated many-to-many table gets the wrong size (255):
Code:
create table SVD_WATCH (
ContentId INT not null,
UserId VARCHAR(255) not null,
primary key (UserId, ContentId)
);
I can fix it by changing the mapping to:
Code:
<set name="watches" table="SVD_WATCH" inverse="true" >
<key column="ContentId"/>
<many-to-many class="com.avalon.seaview.domain.User">
<column name="UserId" length="20"/>
</many-to-many>
</set>
But I'd rather not do this because if I change the length of the field I could easily forget to update it in other spots.
Should tapestry be picking up the length automatically? If so I'll raise a report for it.