Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Trying to use entities in a library in another EJB

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

Entity

Interface:


Server


application


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


[ September 13, 2008: Message edited by: aranian ]
[ September 13, 2008: Message edited by: aranian ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic