• Post Reply Bookmark Topic Watch Topic
  • New Topic

Use of persistence unit in JPA  RSS feed

 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
I was wondering what could be the use of the "persistence-unit"

Is it something that can be used if I wanted to have connectivity to more than one database ( by defining multiple "persistence-unit" elements ) ?

Also didnt know what the purpose of the attribute :: " transaction-type="RESOURCE_LOCAL" " is ?

Thanks ,
~satish
 
Thiebaut olivier
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

You can describe mutltiple connexion in a persistence.xml file, unit test use "RESOURCE-LOCAL" for example. But if you develop an J2EE application with a connexion pool you must use transaction-type="JTA"

RESOURCE-LOCAL -> jdbc simple connect
JTA _> pool connect


olivier
 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks .

So we should use RESOURCE LOCAL in a non managed environment ( outside of Container ) while we should use JTA when inside a container

~satish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!