-->
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.  [ 3 posts ] 
Author Message
 Post subject: entity-name and "persistent class not known"
PostPosted: Wed Apr 15, 2009 11:32 am 
Newbie

Joined: Thu Apr 09, 2009 10:38 am
Posts: 3
Hibernate version: 3.1.2

I'm trying to use entity-name to map a series of objects to two different tables, but I get the following error on startup:


Code:
Caused by: org.hibernate.MappingException: persistent class not known: uk.co.formfill.dfcommon.domain.dfwv.NoteHeader
   at org.hibernate.cfg.Configuration$1.getIdentifierType(Configuration.java:1917)
   at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:226)
   at org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:236)
   at org.hibernate.type.ManyToOneType.getColumnSpan(ManyToOneType.java:41)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.ToOne.isValid(ToOne.java:82)
   at org.hibernate.mapping.Property.isValid(Property.java:185)
   at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:395)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:984)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
   at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
   ... 193 more


This appears to relate to the following extracts from mapping files:

Code:
<hibernate-mapping package="uk.co.formfill.dfcommon.domain.dfwv">
   <class name="uk.co.formfill.dfcommon.domain.dfwv.NoteDetail"
          table="NOTE_DETAILS"
          entity-name="FlowNoteDetail">
....
<many-to-one name="noteHeader"
                   entity-name="FlowNoteHeader"
                   foreign-key="NOTE_HEADERS_FK" index="HEADER_IDX">
         <meta attribute="use-in-tostring">true</meta>
         <column name="NOTE_HEADERS_ID" not-null="true" />
      </many-to-one>



Code:
<hibernate-mapping package="uk.co.formfill.dfcommon.domain.dfwv">
   <class name="uk.co.formfill.dfcommon.domain.dfwv.NoteHeader"
          table="NOTE_HEADERS"
          entity-name="FlowNoteHeader">
...
<set name="details" inverse="true" lazy="false" cascade="all" order-by="DATE_CREATED desc">
         <meta attribute="use-in-tostring">false</meta>
         <key column="NOTE_HEADERS_ID" />
         <one-to-many class="uk.co.formfill.dfcommon.domain.dfwv.NoteDetail"
                      entity-name="FlowNoteDetail" />
      </set>


This seems to be because the code in question is trying to find the object in the classes map using the full class name as a key, whereas they are stored under the key of the entity name.

Is this a bug or have I made a mistake in the mappings?

I would be very grateful for any help as I am almost at the stage of having to give up on trying to get the entity-name feature to work is I cannot resolve this issue.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 15, 2009 12:53 pm 
Regular
Regular

Joined: Thu Sep 06, 2007 2:22 am
Posts: 108
Location: Noida,India
Please remove package attribute form the <hibernate-mapping> element. this will start working.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 15, 2009 1:05 pm 
Newbie

Joined: Thu Apr 09, 2009 10:38 am
Posts: 3
Thanks for the suggestion, but I still get the same error when the package attribute is removed from the hibernate-mapping element.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.