• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JPA Where do I need to define the datasource?

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I have developed a simple JEE application to learn this new technology. I created a EAR file which contains a WAR file and a JAR file. The JAR file contains my JPA code. All works fine but at the moment I have transaction-type = "RESOURCE_LOCALE". In other words the connection is not managed by the application server. I now want to move to the next step and change transaction-type = "JTA". This however means that I also need to define jta-data-source value. I created the data source from the application server (I tried on Geronimo and GlassFish). My problem is that when I deploy the application I get an error that it could not find the data source.

Since I am getting the same error on two different application servers I know that the problem is on my side. However I cannot understand where. After a lot of search on the Internet I tried to create an ejb-jar.xml file in my JAR file and set my datasource reference there. However this is not working either.

My question is; if I am creating a JPA library to be deployed on an application server, do I need to define the data source anywhere? and if yes where? A simple hint would really help me a lot.
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You create a jdbc resource and then create a JNDI reference for it. In glassfish you can do these through web based administration (localhost:4848)

regards,
Nirvan.
 
reply
    Bookmark Topic Watch Topic
  • New Topic