File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes JPA  without container? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA  without container?" Watch "JPA  without container?" New topic
Author

JPA without container?

Xavier George
Ranch Hand

Joined: Jul 29, 2005
Posts: 39
Can we run JPA (prog devloped using jsp api) without application server?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

JPA can be used by any J2SE application, so it's ok as long as you have a JPA implementation (Hibernate, TopLink...)


[My Blog]
All roads lead to JavaRanch
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Please do not duplicate post. You already posted this in the ORM forum, which is the correct forum.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Xavier George
Ranch Hand

Joined: Jul 29, 2005
Posts: 39
WOW

Thats mean I do not need full fledge container. What I need is JPA binaries(jar instead of hibernate.jar(s)). So, I can write the persistent layer using JPA and can persist from java main().

Client with java main() -> persistence layer(JPA) -> DB Layer. (No container)

But, I could not understand why we need JPA implementation. Is it not part of the JPA library. Why we should rely on hibernate/iBatis etc?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

But, I could not understand why we need JPA implementation

JPA is only a set of interfaces with one utility class to get an entity manager factory (javax.persistence.Persistence). EntityManagerFactory and other interfaces are implemented by a provider, so without it you're not going to do anything.
[ April 26, 2007: Message edited by: Satou kurinosuke ]
Xavier George
Ranch Hand

Joined: Jul 29, 2005
Posts: 39
Ok, that means you are saying provider for JPA could be Hibernate. So what I understood is - Hibernate could be JPA provider because Hibernate config file i.e. hibernate.cfg.xml encapsulate database related information which is responsible for managing DB connection pooling etc. which JPA could not provide.
Correct me if I am wrong.
Erik Bengtson
Ranch Hand

Joined: Dec 06, 2003
Posts: 90
In JPA you can either use annotations or orm.xml metadata file to define database related information.

Another JPA implementation to try is JPOX. The implementation that I'm developing

http://jpox.org
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Originally posted by Xavier George:
Ok, that means you are saying provider for JPA could be Hibernate. So what I understood is - Hibernate could be JPA provider because Hibernate config file i.e. hibernate.cfg.xml encapsulate database related information which is responsible for managing DB connection pooling etc. which JPA could not provide.
Correct me if I am wrong.


Yes, Hibernate implements the JPA specification. You need to have some products implementation for it to run.

Mark
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Originally posted by Mark Spritzler:


Yes, Hibernate implements the JPA specification. You need to have some products implementation for it to run.

Mark


Can. Have. I worked with the OpenJPA folks over on the Apache site and did just fine. Found a few bugs for them, even!


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA without container?