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
|