-->
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: org.hibernate.MappingException: Unknown entity
PostPosted: Wed Jun 29, 2011 2:27 am 
Newbie

Joined: Wed Jun 29, 2011 1:44 am
Posts: 2
I created a persistence entity and added mapping content in the *.hbm.xml,then I got the errors below while saving the entity which my new added in my application.

Code:
[6/29/11 11:03:23:143 CST] 0000005f SystemOut     O 11:03:23,134 [WebContainer : 0] ERROR ExceptionHandler : Exception: Unknown entity: com.ibm.cdl.scst.domain.processdata.SystemSunsetProcessData; nested exception is org.hibernate.MappingException: Unknown entity: com.ibm.cdl.scst.domain.processdata.SystemSunsetProcessData
org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: com.ibm.cdl.scst.domain.processdata.SystemSunsetProcessData; nested exception is org.hibernate.MappingException: Unknown entity: com.ibm.cdl.scst.domain.processdata.SystemSunsetProcessData
Caused by:
org.hibernate.MappingException: Unknown entity: com.ibm.cdl.scst.domain.processdata.SystemSunsetProcessData
   at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:512)
   at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1272)
   at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
   at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:460)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:84)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
   at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:520)
   at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:513)
   at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:509)
   at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:689)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
   at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:686)
   at com.ibm.cdl.scst.serviceimpl.BaseServiceSupport.saveEntity(BaseServiceSupport.java:39)
   at com.ibm.cdl.scst.serviceimpl.processdata.SystemRemovalServiceImpl.saveEntityTest2(SystemRemovalServiceImpl.java:100)


Here is the entity:
Code:
public class SystemSunsetProcessData extends ProcessData {
   private static final long serialVersionUID = -1628233347006280595L;
   /**
    * @hibernate.property column="EVIDENCE" length="1000"
    *
    */
   private String evidence;
   /**
    * @hibernate.property column="EVIDENCE_FILE_PATH" length="200"
    *
    */
   private String evidenceFilePath;

   /**
    * @hibernate.property column="EVIDENCE_FILE_NAME" length="200"
    *
    */
   private String evidenceFileName;

   public SystemSunsetProcessData() {
   }

   /**
    *
    *
    * @hibernate.property column="EVIDENCE" length="200"
    *
    */
   public String getEvidence() {
      return this.evidence;
   }

   public void setEvidence(String evidence) {
      this.evidence = evidence;
   }

   /**
    *
    *
    * @hibernate.property column="EVIDENCE_FILE_NAME" length="200"
    *
    */
   public String getEvidenceFileName() {
      return this.evidenceFileName;
   }

   public void setEvidenceFileName(String evidenceFileName) {
      this.evidenceFileName = evidenceFileName;
   }

   /**
    *
    *
    * @hibernate.property column="EVIDENCE_FILE_PATH" length="200"
    *
    */
   public String getEvidenceFilePath() {
      return this.evidenceFilePath;
   }

   public void setEvidenceFilePath(String evidenceFilePath) {
      this.evidenceFilePath = evidenceFilePath;
   }

   public String getRealEvidenceFileName() {
      if (StringUtil.isEmpty(this.evidenceFilePath)) {
         return null;
      }

      return FileUtil.getRealFilePath(this.evidenceFilePath, Constant.FileCategory.SystemRemoval);
   }

   public int hashCode() {
      final int prime = getClass().hashCode();
      int result = 1;
      result = prime * result + id;
      return result;
   }

   public boolean equals(Object obj) {
      if (this == obj)
         return true;
      if (obj == null)
         return false;
      if (getClass() != obj.getClass())
         return false;
      final SystemSunsetProcessData other = (SystemSunsetProcessData) obj;
      if (id != other.id)
         return false;
      return true;
   }

}


Here is ProcessData.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="com.ibm.cdl.scst.domain.processdata.ProcessData"
    table="PROCESSDATA"
    dynamic-update="true"
    dynamic-insert="true"
    select-before-update="true">
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="PROCESSDATA"
        dynamic-update="true"
        dynamic-insert="true"
        select-before-update="true"
    </meta>
    <meta attribute="implement-equals" inherit="false">true</meta>
    <meta attribute="implements" inherit="false">com.ibm.cdl.common.Identifiable</meta>
    <meta attribute="implements" inherit="false">com.ibm.cdl.common.Versionable</meta>

    <id
        name="id"
        type="int"
        column="ID"
        unsaved-value="0"
    >
        <meta attribute="field-description">
           @hibernate.id
            generator-class="identity"
            type="int"
            column="ID"
            unsaved-value="0"

        </meta>
        <generator class="identity" />
    </id>
    <!--
    <version
        name="version"
        type="int"
        column="VERSION"
    />
    -->

    <property
        name="processStarter"
        type="java.lang.String"
        column="PROCESS_STARTER"
        not-null="true"
        length="100"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="PROCESS_STARTER"
            length="100"
            not-null="true"
        </meta>
    </property>
    <property
        name="processInstanceId"
        type="long"
        column="PROCESS_INSTANCE_ID"
        length="100"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="PROCESS_INSTANCE_ID"
            length="100"
        </meta>
    </property>
    <property
        name="active"
        type="boolean"
        column="IS_ACTIVE"
        not-null="true"
        length="10"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="IS_ACTIVE"
            length="10"
            not-null="true"
        </meta>
    </property>
    <property
        name="createCep"
        type="boolean"
        column="CREATE_CEP"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="CREATE_CEP"
            length="1"
        </meta>
    </property>
    <property
        name="startTime"
        type="java.util.Date"
        column="START_TIME"
        length="26"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="CREATE_TIME"
            length="26"
        </meta>
    </property>
    <property
        name="finishTime"
        type="java.util.Date"
        column="FINISH_TIME"
        length="26"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="FINISH_TIME"
            length="26"
        </meta>
    </property>

    <!-- Associations -->

    <!-- bi-directional many-to-one association to Cep -->
    <many-to-one
        name="cep"
        class="com.ibm.cdl.scst.domain.Cep"
        not-null="true"
        fetch="join"
        lazy="false"
        cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
            not-null="true"
           @hibernate.column name="CEP_ID"
        </meta>
        <column name="CEP_ID" />
    </many-to-one>

    <!-- bi-directional many-to-one association to Maintenance -->
    <many-to-one
        name="maintenance"
        class="com.ibm.cdl.scst.domain.Maintenance"
        not-null="true"
        fetch="join"
        lazy="false"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
            not-null="true"
           @hibernate.column name="MAINTENANCE_ID"
        </meta>
        <column name="MAINTENANCE_ID" />
    </many-to-one>

    <joined-subclass
        name="com.ibm.cdl.scst.domain.processdata.ConfidentialChangeProcessData"
        table="PROCESSDATA_CONFIDENTIAL_CHANGE"
        dynamic-update="true"
        dynamic-insert="true">
        <key column="ID" />
       <property
           name="changeToConfidential"
           type="boolean"
           column="CHANGE_TO_CONFIDENTIAL"
           not-null="true"
           length="1"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="CHANGE_TO_CONFIDENTIAL"
               length="1"
               not-null="true"
           </meta>
       </property>
       <property
           name="checkList"
           type="java.lang.String"
           column="CHECK_LIST"
           length="200"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="CHECK_LIST"
               length="200"
           </meta>
       </property>
       <property
           name="cbnId"
           type="int"
           column="CBN_ID"
           length="10"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="CBN_ID"
               length="10"
           </meta>
       </property>
    </joined-subclass>
<!-- add  by Z.Q.Feng for SystemSunsetProcessData-->
    <joined-subclass
        name="com.ibm.cdl.scst.domain.processdata.SystemSunsetProcessData"
        table="PROCESSDATA_SERVER_REMOVAL"
        dynamic-update="true"
        dynamic-insert="true">
        <key column="ID" />
        <property
            name="evidence"
            type="string"
            column="EVIDENCE"
            length="1000"
        >
            <meta attribute="field-description">
               @hibernate.property
                column="EVIDENCE"
                length="1000"
            </meta>
        </property>
        <property
            name="evidenceFilePath"
            type="string"
            column="EVIDENCE_FILE_PATH"
            not-null="false"
            length="200"
        >
            <meta attribute="field-description">
               @hibernate.property
                column="EVIDENCE_FILE_PATH"
                not-null="false"
                length="200"
            </meta>
        </property>
        <property
            name="evidenceFileName"
            type="string"
            column="EVIDENCE_FILE_NAME"
            not-null="false"
            length="200"
        >
            <meta attribute="field-description">
               @hibernate.property
                column="EVIDENCE_FILE_NAME"
                not-null="false"
                length="200"
            </meta>
        </property>
    </joined-subclass>
   
</class>
</hibernate-mapping>


Note:I doubt that ProcessData.hbm.xml doesn't work.In order to test,I delete the ProcessData.hbm.xml from my application.However,i was surprised that the original entity 'ConfidentialChangeProcessData' saving is success but my new added was still facing the same errors 'org.springframework.orm.hibernate3.HibernateSystemException'.
So I can't understand why the original entity was still success without ProcessData.hbm.xml file.I'm sure that there is currently not ProcessData.hbm.xml in my application.
And I got the track stack from SystemOut_11.06.29_10.44.54.log when Hibernate initialization.So where was ProcessData.hbm.xml from?
Code:
[6/29/11 10:43:53:094 CST] 00000080 Configuration I org.hibernate.cfg.Configuration addJar Found mapping document in jar: com/ibm/cdl/scst/domain/processdata/ProcessData.hbm.xml
[6/29/11 10:43:53:202 CST] 00000080 HbmBinder     I org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues Mapping class: com.ibm.cdl.scst.domain.processdata.ProcessData -> PROCESSDATA


Dose anyone have the suggestions or solution for the issue?
Thanks for your help in advance!

Regards


Top
 Profile  
 
 Post subject: Re: org.hibernate.MappingException: Unknown entity
PostPosted: Wed Jun 29, 2011 10:18 pm 
Newbie

Joined: Wed Jun 29, 2011 1:44 am
Posts: 2
Anybody who can tell me what I should do? Or what I'm doing wrong?
It's appreciate for your great help!


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.