• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA Where do I need to define the datasource?  RSS feed

 
Simon Joseph Aquilina
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • 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.
 
B Nirvan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!