-->
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: Help with mapping
PostPosted: Fri Dec 05, 2003 12:20 pm 
Newbie

Joined: Fri Dec 05, 2003 12:15 pm
Posts: 1
I have 3 classes : Resource, Role and Permission

Resource: id, date
Role: name
Permission: id, role, permission

Role is a subclass of Resource.

Permission contains Resource and Role.

I have a problem with my mapping file. Could you help me? I don't know
how to represent that.

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>

<class name="Permission" table="DWPermission">
<id name="id" column="id" type="long">
<generator class="native"/>
</id>

<component name="role" class="Role">
<property name="idRole" type="long"/>
</component>

<component name="ressource" class="Resources">
<property name="idResource" type="long"/>
</component>
</class>

<class name="Resources" table="DWResources">
<id name="id" column="id" type="long">
<generator class="native"/>
</id>

<property name="date" type="timestamp"/>
<joined-subclass name="Role" table="DWRole">
<key column="resourceId"/>
<property name="name" type="string" unique="true"/>
</joined-subclass>

</class>

</hibernate-mapping>

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 06, 2003 9:22 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
reread the documentation, either :
- use component but do not map role and Resource as Entity (<class>).
- use Entity and map the link with a one-to-one or another association.

I don't think components can be subclasses, then the second solution is the one you need.

_________________
Emmanuel


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.