Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to use entities in a library in another EJB

Sebastian L�tge
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to split my application into four parts:
- a library that contains my entities
- a library that contains remote interfaces
- the server code, using the two libraries to implement the interfaces
- and the application, using the two libraries to query the server and handle display etc.

i have a persistence.xml in the entity library and that works fine. i put the library in the domain1/lib folder in my glassfish. The interfaces also go there.
Now when i use no persistence.xml in my server project the project does not deploy:
Deploying application in domain failed; Deployment Error -- Could not resolve a persistence unit corresponding to the persistence-context-ref-name [aranian.wh40k.server.ejb.WH40kUserValidationBean/em] in the scope of the module called [D:\Projekte\WH40kServer\build\jar]. Please verify your application.

When i use the same persistence.xml as my library (especially unitName) i am able to deploy the server project, but i get an error saying my entity (created in the library) is unknown when i call a remote method from my client:
Caused by: org.hibernate.MappingException: Unknown entity: aranian.lib.entities.test.WH40kTest

i want to split the code into these four parts to keep server and client separate. i guess it would work if everything was in one big project, but i'd like to do it this way. could someone point me in the right direction what i'm missing?





persistence.xml (used in both entity library and server)

[ September 13, 2008: Message edited by: aranian ]
[ September 13, 2008: Message edited by: aranian ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic