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
----------------------------------------------------------------------------
|