• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JPA without container?

 
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?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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...)
 
ranger
Posts: 17344
11
Mac IntelliJ IDE 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 VI Editor Ubuntu
  • 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.
 
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
Posts: 17344
11
Mac IntelliJ IDE 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
 
Bartender
Posts: 20827
125
Android Eclipse IDE Tomcat Server Redhat Java 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
Boost this thread!