File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sun specific JPA in hibernate

 
Ravi kapa
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Pie
Posts: 2496
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Bartender
Pie
Posts: 2496
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k.thank you for the information.I want to develop JDO simple application can you help me on this?
 
Tim Moores
Bartender
Pie
Posts: 2496
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic