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>
|