-->
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: Can't initialise Hibernate session- Mapping exception !!
PostPosted: Thu Apr 08, 2004 12:02 pm 
Newbie

Joined: Tue Mar 23, 2004 12:21 pm
Posts: 11
Hello All,
I have a class with composite primary key. The mapping file for this class is shown below.

class--> MwpCatUserAssoc

primary key class -> MwpCatUserAssocPk

-------------------------------------------------------------------------------
<?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="com.xyz.managed.abc.entity.MwpCatUserAssoc" table="MWP_CAT_USER_ASSOC">
<composite-id name="comp_id" class="com.xyz.managed.abc.entity.MwpCatUserAssocPk">
<key-property name="subscriber" column="SUBSCRIBER" type="long"/>
<key-property name="categoryId" column="CATEGORY_ID" type="long"/>
</composite-id>
<property name="name" column="NAME" type="string" length="128" not-null="false"/>
<property name="seqNumber" column="SEQNO" type="long" not-null="false"/>
<property name="visible" column="VISIBLE" type="character" not-null="false"/>
</class>

</hibernate-mapping>



---------------------------------------------------------------------------------


when I run my code , I get a mapping exception which says can't initialise hibernate session. The exception is shown below
Ps: notice the last line of exception whic talks abt duplicate import. I am not sure what that means. Any help will be greatly appreciated.
------------------------------------------------------------------------------
Can't Initialize Hibernate Session
net.sf.hibernate.MappingException: Error reading resource: com/xyz/managed/abc/entity/MwpCatUserAssoc.hbm.xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:318)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842)
at com.xyz.managed.abc.database.hibernate.DAOSession.init(DAOSession.java:41)
at com.xyz.managed.abc.database.hibernate.DAOSession.getDAOSessionInstance(DAOSession.java:108)
at com.xyz.managed.abc.database.hibernate.DataAccessObject.retrieveObj(DataAccessObject.java:187)
at com.xyz.managed.abc.database.hibernate.TestingJunction.testMyCode(TestingJunction.java:43)
at com.xyz.managed.abc.database.hibernate.TestingJunction.main(TestingJunction.java:28)

Caused by: net.sf.hibernate.MappingException: duplicate import: MwpCatUserAssoc
----------------------------------------------------------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 08, 2004 2:28 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you need equals/hashcode + implements serializable,
i remember i had a duplicate import error on a class with composite id


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.