Hi all,
I try to insert a row in the table, but i get this error message:
Hibernate version: hibernate-3.2.5.ga
Java code:
Code:
public class TestUser {
public static void main(String[] args) {
Configuration conf = new AnnotationConfiguration();
conf.configure();
SessionFactory factory = conf.buildSessionFactory();
Session session = factory.openSession();
User u = new User();
u.setUser("admin");
u.setPasswd("admin");
Transaction t = session.beginTransaction();
session.save(u);
t.commit();
session.close();
}
}
Console output:
Quote:
14:57:49,984 DEBUG DefaultSaveOrUpdateEventListener:158 - saving transient instance
Exception in thread "main" org.hibernate.MappingException: Unknown entity: br.org.xxxxxxxx.jdbc.model.User
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:98)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
at br.org.xxxxxxxx.hibernate.TestUser.main(TestUser.java:21)
[/code]