Exception in thread "main" org.hibernate.MappingException: Unbekanntes Wesen: vom Ziel

Lerne ich den Ruhezustand und ich kann nicht herausfinden, warum diese Fehler auftauchen. Ich habe versucht der Suche, aber ich konnte nicht finden, eine Lösung, die mir geholfen haben. Ich würde gerne erfahren, warum bin ich immer diese Fehlermeldung.

Exception in thread "main" org.hibernate.MappingException: Unknown entity: from Destination

Hier sind einige details:

main():

    public static void main(String[] args) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();

//     Destination destination = new Destination();
//     destination.setName("IDelhi");
//     destination.setLatitude(1.0f);
//     destination.setLongitude(123.0f);
//     session.save(destination);

        List result = session.createCriteria("from Destination").list();

        session.getTransaction().commit();

        session.close();

//     for (Object dest : result) {
//         Destination d = (Destination)dest;
//         System.out.println(d.getId() + ": "+ d.getName());
//     }
    }
}

Wenn ich versuche, legen Sie die Ziel - (code auskommentiert), Werte eingefügt werden in die db.

Konfigurationen:

hibernate.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="">
  <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
  <property name="hibernate.connection.password">*****</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/</property>
  <property name="hibernate.connection.username">*****</property>
  <property name="hibernate.default_schema">wah_schema</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
  <!-- Echo all executed SQL to stdout -->
  <property name="show_sql">true</property>
  <!-- Enable Hibernate's automatic session context management -->
  <property name="current_session_context_class">thread</property>
  <mapping class="org.wah.dao.Destination" resource="org/wah/dao/Destination.hbm.xml"/>
 </session-factory>
</hibernate-configuration>

Destination.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jan 25, 2012 3:31:00 PM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
 <class name="org.wah.dao.Destination" table="DESTINATION">
  <id name="id" type="int">
   <column name="ID"/>
   <generator class="identity"/>
  </id>
  <property generated="never" lazy="false" name="name" type="java.lang.String">
   <column name="NAME"/>
  </property>
  <property generated="never" lazy="false" name="latitude" type="float">
   <column name="LATITUDE"/>
  </property>
  <property generated="never" lazy="false" name="longitude" type="float">
   <column name="LONGITUDE"/>
  </property>
 </class>
</hibernate-mapping>

Kann mir bitte jemand helfen dies herauszufinden ?

InformationsquelleAutor brainydexter | 2012-01-26
Schreibe einen Kommentar