This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes Sun specific JPA in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Sun specific JPA in hibernate" Watch "Sun specific JPA in hibernate" New topic
Author

Sun specific JPA in hibernate

Ravi kapa
Ranch Hand

Joined: Jan 05, 2012
Posts: 87
Hi,i wrote JPA code in hibernate and i use hibernate specific interfaces and clasess in main class like Annotation configuration etc and i want to convert it to sun JPA specific so that i can execute in any vendor framework.And i used hibernate conf file for database configuration and named it hibernate,cfg..how can i save it for sun specific.Anyone suggest me please....
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
What do you mean by "Sun specific"? JPA is JPA - it's the same everywhere.

And what do you mean by "wrote JPA code in hibernate" - either you used the JPA API (possibly using Hibernate as the JPA implementation) or you used the Hibernate API; which one is it?
Ravi kapa
Ranch Hand

Joined: Jan 05, 2012
Posts: 87

In the above code i used hibernate specific code like AnnotationConfiguration and SessionFactory interfaces which are works in hibernate only it may not work in other vendors like Oracle toplink,Apache openJPA.So if i use sun specific interfaces like EntityManagerFactory and EntittyTransaction it may execute in any vendor.And for Database Cofiguration i use hibernate configuration file

i corrected this file according to sun specific JPA like renaming the file as persistence.xml and fields as property name and value...Finally what my problem is where i can put this xml file(in hibernate i paste it in package itself)
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Again: there is no such thing as "Sun specific API". If you want code that's portable across JPA implementations then you need to use the JPA API exclusively.
Ravi kapa
Ranch Hand

Joined: Jan 05, 2012
Posts: 87
k.thank you for the information.I want to develop JDO simple application can you help me on this?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
JDO is dead for all practical purposes; use JPA instead. But I'm sure the JDO web site has example code, as has any JDO implementation.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3826

Hi Ravi kapa,

Please be specific when you asking questions and stick with the original topic/content. You can post questions on separate threads about other topics.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
Consider Paul's rocket mass heater.
 
subject: Sun specific JPA in hibernate