I'm working with Hibernate 2.1 and XDoclet 1.2, and am writing Java classes to use with XDoclet for an existing database schema. Just started two days ago, so I'm still taking it all in.
Currently, I'm working on a set of classes that work as follows:
table "groups" contains:
primary key "groupid" of type integer
... (other irrelevant fields)
table "permissionrule" contains:
foreign key "actorgroupid" references "groups"
foreign key "targetgroupid" references "groups"
column "actionname" of type text
The following two set mappings for the Group class (mapped to "groups" table) do exactly what I want... please excuse possible errors in simplifying and posting the mapping, but this works great in real life.
<set name="permissions" table="permissionrule">
<key column="actorgroupid"/>
<composite-element class="Permission">
<parent name="actor"/>
<property name="actionName"
column="actionname" type="string"/>
<many-to-one name="target"
column="targetgroupid" class="Group"/>
</composite-element>
</set>
<set name="targetPermissions" table="permissionrule">
<key column="targetgroupid"/>
<composite-element class="Permission">
<parent name="target"/>
<property name="actionName"
column="actionname" type="string"/>
<many-to-one name="actor"
column="actorgroupid" class="Group"/>
</composite-element>
</set>
Now, I would like to achieve this with XDoclet tags. Is it possible?
Thanks in advance,
_________________ --
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere!
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation
|