-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Mapping problem
PostPosted: Mon Feb 16, 2004 4:05 am 
Regular
Regular

Joined: Thu Nov 20, 2003 10:04 pm
Posts: 64
Location: Melbourne, Australia
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 5:46 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the forum, this has been discussed. If there is no solution, raise it to JIRA

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 3:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This would be a bug, if true - but I can hardly believe it....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 4:07 am 
Regular
Regular

Joined: Thu Nov 20, 2003 10:04 pm
Posts: 64
Location: Melbourne, Australia
I'll put together a small test project for you. I don't think I'm doing anything stupid but it's always possible.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.