Базовый пример используемых аннотаций.Настроил класс отображения в hibernate.cfg.xml.Но я получаю это исключение org.hibernate.MappingException: Unknown entity: com.fh.entities.Customer
package com.fh.entities;
@Entity
public class Customer {
@Id
private int id;
private String firstName;
private String lastName;
private String mobile;
private String email;
//setters & getters.
}
В hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
<property name="connection.username">test</property>
<property name="connection.password">system</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping class ="com.fh.entities.Customer"></mapping>
</session-factory>
</hibernate-configuration>
Я получаю исключение в Eclipse, как показано ниже:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
Exception in thread "main" org.hibernate.MappingException: Unknown entity: com.fh.entities.Customer