I've run into a MappingException during a session.save(object) after migrating from hibernate 2.0 to 3.1.2. Please note that there is no class name associated with the error "Unknown entity: " - Anyone have any ideas on why this would be?
Thanks in advance for your help.
Hibernate version:
Version 3.1.2
Mapping documents:
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="com.kohls.pm.pp.common.entity.PermPriceChangeEvent"
table="PET_PERM_EVNT"
select-before-update="true"
>
<id
name="id"
type="java.lang.Long"
column="PERM_EVNT_ID"
unsaved-value="-1"
>
<generator class="sequence">
<param name="sequence">PES_PRCHG_SEQ</param>
</generator>
</id>
<property
name="effectiveDate"
type="java.util.Calendar"
column="EFF_DTE"
not-null="true"
length="7"
/>
<property
name="inProcessDate"
type="java.util.Calendar"
column="INPROC_TMST"
length="7"
/>
<property
name="lockoutDate"
type="java.util.Calendar"
column="LCK_OUT_TMST"
not-null="true"
length="7"
/>
<property
name="permEvntNm"
type="java.lang.String"
column="PERM_EVNT_NM"
length="30"
/>
<property
name="ohAutoCountIndicator"
type="java.lang.String"
column="OH_AUTO_CNT_IND"
length="1"
/>
<property
name="statusCode"
type="java.lang.String"
column="STAT_CDE"
not-null="true"
length="1"
/>
<property
name="createDate"
type="java.util.Calendar"
column="CRE_TMST"
not-null="true"
length="7"
/>
<property
name="creator"
type="java.lang.String"
column="CRE_BY_USR_ID"
not-null="true"
length="8"
/>
<property
name="lastUpdateDate"
type="java.util.Calendar"
column="LAST_UPD_TMST"
not-null="true"
length="7"
/>
<property
name="lastUpdater"
type="java.lang.String"
column="LAST_UPD_BY_USR_ID"
not-null="true"
length="8"
/>
<!-- associations -->
<!-- bi-directional one-to-many association to PetPermEvntDeptOvrrid -->
<bag
name="departmentOverrides"
lazy="true"
inverse="true"
cascade="save-update"
>
<key>
<column name="PERM_EVNT_ID" />
</key>
<one-to-many
class="com.kohls.pm.pp.common.entity.PermEventDepartmentOverride"
/>
</bag>
<!-- bi-directional one-to-many association to PetStrGpPrchgAssn -->
<bag
name="strGpPrchgAssns"
lazy="true"
inverse="true"
>
<key>
<column name="PERM_EVNT_ID" />
</key>
<one-to-many
class="com.kohls.pm.pp.common.entity.hibernate.PetStrGpPrchgAssn"
/>
</bag>
<!-- bi-directional one-to-many association to PetPermEvntMdseSeln -->
<bag
name="merchandiseSelections"
lazy="true"
inverse="true"
cascade="save-update"
>
<key>
<column name="PERM_EVNT_ID" />
</key>
<one-to-many
class="com.kohls.pm.pp.common.entity.PermEventMerchandiseSelection"
/>
</bag>
<!-- bi-directional many-to-one association to PetEvntCtg -->
<many-to-one
name="category"
lazy="false"
class="com.kohls.pm.pp.common.entity.PermPriceChangeEventCategory"
not-null="true"
>
<column name="EVNT_CTG_CDE" />
</many-to-one>
</class>
</hibernate-mapping>
Let me know if you need additional associated mappings.
Code between sessionFactory.openSession() and session.close():
session.save(object); NOTE: this is when exception happens = BaseDao.java:289
session.flush();
Full stack trace of any exception that occurs:
org.hibernate.MappingException: Unknown entity:
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(Ljava.lang.String;)Lorg.hibernate.persister.entity.EntityPersister;(SessionFactoryImpl.java:513)
at org.hibernate.impl.SessionImpl.getEntityPersister(Ljava.lang.String;Ljava.lang.Object;)Lorg.hibernate.persister.entity.EntityPersister;(SessionImpl.java:1321)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(Ljava.lang.Object;Ljava.lang.String;Ljava.lang.Object;Lorg.hibernate.event.EventSource;)Ljava.io.Serializable;(AbstractSaveEventListener.java:89)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(Lorg.hibernate.event.SaveOrUpdateEvent;)Ljava.io.Serializable;(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(Lorg.hibernate.event.SaveOrUpdateEvent;)Ljava.io.Serializable;(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(Lorg.hibernate.event.SaveOrUpdateEvent;)Ljava.io.Serializable;(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(Lorg.hibernate.event.SaveOrUpdateEvent;)Ljava.io.Serializable;(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(Lorg.hibernate.event.SaveOrUpdateEvent;)V(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(Lorg.hibernate.event.SaveOrUpdateEvent;)Ljava.io.Serializable;(SessionImpl.java:559)
at org.hibernate.impl.SessionImpl.save(Ljava.lang.String;Ljava.lang.Object;)Ljava.io.Serializable;(SessionImpl.java:547)
at org.hibernate.impl.SessionImpl.save(Ljava.lang.Object;)Ljava.io.Serializable;(SessionImpl.java:543)
at com.kohls.pm.pp.server.dao.BaseDao.insert(Ljava.lang.Object;)V(BaseDao.java:289)
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
Modified, right before insert sql is generated (does not show)
select * from K_PE01.PET_PERM_EVNT where EFF_DTE=? and EVNT_CTG_CDE=? and STAT_CDE in (?, ?)
select * from K_PE01.PET_PERM_EVNT where this_.EFF_DTE=? and STAT_CDE in (?, ?)
EXPECTING INSERT SQL HERE!
Debug level Hibernate log excerpt:
*********************************************************************