First, i'd like to congrats you all. You've been done a great work with hibernate.
This is my last chance. I've posted it in many forums world wide. And there are some ones similar here which dint solve my problem.
I'm using Hibernate RC2 and Hibernate Annotations RC1. Netbeans 5, java5, firebird1.5 (jaybird).
Its a pretty simple test. Only two classes annotated. Person and User. I've followed your tutorials to annotate them.
This error maybe usual on forums, see:
Code:
Exception in thread "main" org.hibernate.MappingException: Unknown entity: Model.Usuario
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:547)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1331)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:96)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
But i'm really using javax.persistence.* to my classes.
My hibernate.cfg.xml:
Code:
<session-factory>
<mapping class="Model.Person"/>
<mapping class="Model.User"/>
</session-factory>
The rest its in hibernate.properties which works fine (up to now).
I've tryed to put this information on HibernateUtil.java (the class). I've tryed so many different ways to do that. Even giving the place where is my cfg.xml as a parameter. But i got always the same error.
If a delete cfg.xml from my test, i got the same error. I've put it into any possible package. And its always the same error.
I've already tryed to not to use him, and i write my HibernateUtil.java as
Code:
.addAnnotatedClass(Model.Person.class)
you know, just like to tutorial on hibernate.org, but i got the same error!
the hbm2ddl.auto its defined as 'create' in hibernate.properties
Model: Person.java, User.java
Main: Main.java
project root: hibernate.cfg.xml, hibernate.properties, lo4j.properties, HibernateUtil.java
Guys, i'm so sorry if this question is so stupid.
I dont know if its necessary to write my classes here, if it was, please ask to me.
If I missed something, sorry. But i really wanna know how to work with hibernate.