-->
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: Mapping a Set of parent classes
PostPosted: Tue Jun 22, 2004 5:11 pm 
Newbie

Joined: Tue Jun 08, 2004 8:07 pm
Posts: 14
Location: Washington, D.C.
I have an implementation of java.security.acl.Group that I'm trying to map into Hibernate. The GroupImpl class has a Set of Principals inside it for members of that group.

However, I'm having trouble getting the mapping right. Below is the map file...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="PrincipalImpl" table="principals">
<id name="name" type="string" column="principal_key">
<generator class="assigned"/>
</id>
<subclass name="GroupImpl">
<set name="members" table="members" outer-join="true" cascade="all">
<key column="group_key" />
<many-to-many class="PrincipalImpl" foreign-key="group_key"/>
</set>
</subclass>

</class>
</hibernate-mapping>

.... and here is the print out of running SchemaExport... I don't understand why the members table is not being created.

drop table if exists permissions
drop table if exists members
drop table if exists control_lists
drop table if exists principals
drop table if exists acl_entries
drop table if exists hibernate_unique_key
create table permissions (acl_entry_key BIGINT not null, permission VARCHAR(255))
create table members (group_key VARCHAR(255) not null, elt VARCHAR(255) not null, primary key (group_key, elt))
17:05:39,183 ERROR SchemaExport:154 - Unsuccessful: create table members (group_key VARCHAR(255) not null, elt VARCHAR(255) not null, primary key (group_key, elt))
17:05:39,183 ERROR SchemaExport:155 - Invalid argument value, message from server: "Specified key was too long. Max key length is 500"

I'm using MySQL for the database.

thanks,

~harris


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 6:36 pm 
Beginner
Beginner

Joined: Mon Jun 21, 2004 7:59 pm
Posts: 21
Looks like MySQL doesn't like primary key (group_key, elt), where group_key + elt > 500 total size. 255+255 = 510 in this case.

You can try specifying the length of those keys to something smaller. I've also heard about problems with the latest MySQL alpha/beta release. If you're running that release you might want to try the same thing on the latest stable release.

-Jim


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.