Hi all,
I'm totally new with Hibernate. I've got the book java persistence with Hibernate and I tried several google searches. But I can't figure out what my problem is.
I'm developing in Eclipse with Flex Builder plugin on a Flex-Java Hybrid project (possible since Flex Builder 3 final as far as I know). It has 1 project with a flex_src folder, java_src folder and a WebContent where the compiled classes go (META-INF and WEB-INF and the Flex configuration files in WEB-INF.flex).
I have 1 DAO class with the following code:
Code:
public void storeTextMessage(TextMessage textMessage) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("RicohPersistence");
EntityManager em = emf.createEntityManager();
EntityTransaction transaction = em.getTransaction();
transaction.begin();
/*
* Store the whole new object tree
*/
em.persist(textMessage);
/*
* Commit all changes
*/
transaction.commit();
/*
* Close the connection
*/
em.close();
}
and a persistence.xml with <persistence-unit name="RicohPersistence"> and a configuration for a SQL server connection. Now when I start the application and go through the storeTextMessage method I get a "Could not initialize class org.hibernate.ejb.Ejb3" error on the line "EntityManagerFactory emf = Persistence.createEntityManagerFactory("RicohPersistence");"
As far as I know I have all the correct jar files added in a user-library that I have added to the project using the Java Build Path -> Libraries in the project properties.
How do I solve this problem?
Cheers,
Rick