Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA without container?

 
Xavier George
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we run JPA (prog devloped using jsp api) without application server?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JPA can be used by any J2SE application, so it's ok as long as you have a JPA implementation (Hibernate, TopLink...)
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not duplicate post. You already posted this in the ORM forum, which is the correct forum.

Mark
 
Xavier George
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18091
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic