Persistence API with Java SE?
Hi all Java EE fans.
I am not sure if I am posting in the correct section, so apologies to the moderators.
Anyway. I've been messing with Glassfish and building some simple applications using JavaEE.
Love the Persistence API by the way. So I thought it could be cool to implement Persistence API into current applications at work. The software at work is built on SE and access to the database records is very messy, so that's another reason why I would like to incorporate the Persistence API.
The way I do it is, create a project(Objects) and in that project create POJOs (Customer, Order, blah blah blah). Then I build all of that into a .jar file and add it as a library into projects where I would need them.
So the question I have is:
1. For the Persistence API to work it needs the persistence.xml in META-INF folder which I have. But does it need to be in the Objects.jar where POJOs are located or in the actual application project where the Objects.jar is added as a library?
EDIT: Maybe a second question to make things clearer for myself: Could I even use Persistence API without an application server?
Re: Persistence API with Java SE?
How are you creating the pojo objects, is it using some standard tool to generate entities from the database tables, if it is so then as you said you hav the persistent.xml and the dao objects to access those entities.
Yes we need to hav the persistence.xml in Objects.jar to access those entities, it not only contains the entity classes in it but also the information regarding the datasource.