users@glassfish.java.net

Need help with Glassfish, hibernate entitymanager and netbeans

From: <glassfish_at_javadesktop.org>
Date: Thu, 29 May 2008 10:03:21 PDT

I have a running standard java app structured in the following way in netbeans

Netbeans project1: com.mycompany.myapp.mylibofobjectclasses (library)
Netbeans project2: com.mycompany.myapp (java app)
      this contains the Hibernate mappings, the entitymanager generic calls and the classpath
     includes the aforementioned jar library

The app works a a web server (basic socket code in fact) where queries can be sent and translated into DB statements & queries and is perfectly functional

Trying to migrate the project to a glassfish webapp does not seem very straightforward
 Here is what I tried

Netbeans project3: com.mycompany.db (library)
     this contains the hibernate code extracted from project 2 removing all web server code

Netbeans project4: com.mycompany.webservice (glassfish web app)
    attached you can find the persistence.xml file of the netbeans glassfish project
    I added all jar libs in the properties -> libraries of the netbeans project and chose to
    package those in the final war file, ran build, verify, deploy and get the following when
   trying to make a object creation

08:00:27,362 ERROR [httpSSLWorkerThread-8080-0] (DbManager.java:DbManager:107) - Saving object:
java.lang.IllegalArgumentException: Unknown entity: com.mycompany.mylibofobjectclasses.User
        at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:216)
        at com.mycompany.db.DbManager.create(DbManager.java:100)
        at com.mycompany.resources.UsersResource.create(UsersResource.java:137)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Could anyone help me out please
[Message sent by forum member 'obourdon' (obourdon)]

http://forums.java.net/jive/thread.jspa?messageID=277315