-->
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.  [ 2 posts ] 
Author Message
 Post subject: many-to-many trouble with a string key
PostPosted: Tue Aug 31, 2004 11:01 am 
Newbie

Joined: Wed Jul 21, 2004 3:58 am
Posts: 17
Hi !

I've trouble with a many-to-many association. I have two table with a varchar(32) key and when i try to create the many-to-many table with hibernator, i've got the error :


create table User (User_Nom VARCHAR(32) not null, User_Pass VARCHAR(32) not null, primary key (User_Nom))

create table Role (User_Nom VARCHAR(32) not null, primary key (User_Nom))

create table user_role (User_Nom VARCHAR(255) not null, Role_id VARCHAR(255) not null, primary key (User_Nom, Role_id))

Invalid argument value, message from server: "Specified key was too long. Max key length is 500"


How is it possible because the two key are just 32 long.

Mapping documents:

<hibernate-mapping>
<class name="capgemini.gestionav.modele.valueobject.RoleDTO" table="Role">
<id name="nom">
<column name="User_Nom" length="32" not-null="true"/>
<generator class="assigned"/>
</id>
</class>
</hibernate-mapping>

<hibernate-mapping>
<class name="capgemini.gestionav.modele.valueobject.UtilisateurDTO" table="User">
<id name="nom">
<column name="User_Nom" length="32" not-null="true"/>
<generator class="assigned"/>
</id>
<property name="password">
<column name="User_Pass" length="32" not-null="true"/>
</property>
<set name="userroles" table="user_role" inverse="true" lazy="true">
<key column="User_Nom"/>
<many-to-many class="capgemini.gestionav.modele.valueobject.RoleDTO" column="Role_Nom" />
</set>
</class>
</hibernate-mapping>





Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 11:07 am 
Regular
Regular

Joined: Wed Aug 18, 2004 5:16 am
Posts: 69
Location: Modena, Italy
255 + 255 = 510
Perhaps the error is in the key declaration of table user_role.
Try to set to 32 the 2 fields in user_role


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.