-->
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: Unmapped class exception for many-to-many unidirectional
PostPosted: Sat Apr 03, 2010 6:47 pm 
Newbie

Joined: Sat Apr 03, 2010 5:57 pm
Posts: 1
Hi,

I'm trying to create unidirectional many-to-many association. Following are the hbm mappings.

Code:
<hibernate-mapping>
   <class name="com.abc.Person" table="Person" lazy="true">
      <cache usage="read-write" />

      <id name="id" column="ID" type="long" length="30" unsaved-value="null">
         <generator class="native">
            <param name="sequence">PERSON_SEQ</param>
         </generator>
      </id>

      <property name="name" type="string" update="true" insert="true" column="NAME" length="255" not-null="true"
         unique="true" />

      <joined-subclass name="com.abc.User" table="User" lazy="true">
         <key column="IDENTIFIER" />

         <property name="email" type="string" update="true" insert="true" column="EMAIL" length="255" />

         <set name="reminders" table="User_Reminder" inverse="true" lazy="true" cascade="none">
            <cache usage="read-write" />
            <key column="USER_ID" not-null="true" />
            <many-to-many class="com.xyz.Reminder" column="REMINDER_ID" />
         </set>
      </joined-subclass>
   </class>
</hibernate-mapping>


<hibernate-mapping package="com.xyz">
   <class name="Reminder" table="REMINDER">
      <cache usage="read-write" />

      <id name="id" column="ID" type="long" length="30" unsaved-value="null">
         <generator class="native">
            <param name="sequence">REMINDER_SEQ</param>
         </generator>
      </id>

      <property name="name" type="string" update="true" insert="true" column="NAME" length="255" not-null="true"
         unique="true" />

      <property name="description" type="string" update="true" insert="true" column="DESCRIPTION" length="1024" />
   </class>
</hibernate-mapping>


I've included both the hbms in the hibernate.cfg.xml file
<mapping resource="com/xyz/hbm/Reminder.hbm.xml" />
<mapping resource="com/abc/hbm/Person.hbm.xml" />

Please note that, both the class files are in different packages. Also their corresponding hbm files are in different folders, which I think, should not be an issue.

Every time I deploy the war and start the JBoss, I get the following error.
Quote:
01:05:13,484 INFO [STDOUT] ERROR 01:05:13,484 (ORMConnection) - An association from the table USER_REMINDER refers to an unmapped class: edu.xyz.Reminder
01:05:13,484 ERROR [[/myapp]] StandardWrapper.Throwable
org.hibernate.MappingException: An association from the table USER_REMINDER refers to an unmapped class: edu.xyz.Reminder


Please help me solving this issue. Let me know where I'm going wrong. I've been stuck with this problem for too long now.

Thanks


Top
 Profile  
 
 Post subject: Re: Unmapped class exception for many-to-many unidirectional
PostPosted: Mon Apr 05, 2010 10:02 am 
Newbie

Joined: Mon Apr 05, 2010 9:56 am
Posts: 1
Hi Chepa,

I tried ur example and i was successfully able to configure and create a session.

Configuration cfg = new Configuration();
cfg.configure("com/abc/hibernate.cfg.xml");
SessionFactory factory = cfg.buildSessionFactory();
Session session = factory.openSession();

I removed the
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>

as i configured ur mapping as a standalone application.


Please specify at what point u are getting the error.
You will need to lookup in ur application Context Listener (where the hibernate session facory might have been configured in your application. )

Thanks.


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.