-->
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: javax.servlet.UnavailableException
PostPosted: Fri Mar 24, 2006 9:33 am 
Newbie

Joined: Fri Mar 24, 2006 9:21 am
Posts: 2
I am running into the following issue. Any help will be greatly appreciated.

Hibernate version: 2.0

Mapping documents:

RoleManagement.hbm.xml

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

<hibernate-mapping>
<class name="scigames.usermgmt.hibernate.beans.RoleManagement" table="rolemanagement">
<id name="roleMgtKey" column="ROLEMGTKEY">
<generator class="native"/>
</id>
<property name="roleKey" column="ROLEKEY"/>
<property name="usersKey" column="USERSKEY"/>

</class>
</hibernate-mapping>

User.hbm.xml

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

<hibernate-mapping>
<class name="scigames.usermgmt.hibernate.beans.User" table="users">
<id name="usersKey" column="USERSKEY">
<generator class="native"/>
</id>
<property name="networkId" column="NETWORKID"/>
<property name="status" column="STATUS"/>
<property name="languageKey" column="LANGUAGEKEY"/>
<property name="printQ" column="PRINTQ"/>
<property name="comments" column="COMMENTS"/>
<property name="fName" column="FNAME"/>
<property name="lName" column="LNAME"/>

<set name="roleCollection" table="rolemanagement">
<key column="USERSKEY"/>
<many-to-many
column="ROLEMGTKEY"
class="scigames.usermgmt.hibernate.beans.RoleManagement"/>
</set>
</class>
</hibernate-mapping>

When I deploy the application with the above mappings, I get the following error:
javax.servlet.UnavailableException: Foreign key (rolemanagement [ROLEMGTKEY])) must have same number of columns as the referenced primary key (rolemanagement [USERSKEY,ROLEMGTKEY])


Name and version of the database you are using: Using Oracle 10g

Any suggestions?

Thanks

_________________
Sharma Vedula


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 11:43 am 
Newbie

Joined: Tue Mar 21, 2006 1:42 pm
Posts: 14
For many-to-many relationships, the "table" attribute should be the linking table in the many-to-many relationship and that table is generally not mapped. The "class" attribute of the "many-to-many" should be the class on the other end of the relationship which I would assume would be a table that contains the roles in your case. You should really review the association information in the hibernate documents.

_________________
Mike Ringrose


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.