This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Can not run JPA sample example using J2SE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Can not run JPA sample example using J2SE" Watch "Can not run JPA sample example using J2SE" New topic
Author

Can not run JPA sample example using J2SE

Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1000
    
    1

Hi

I am reading "Pro JPA2" book by Mike.
I am trying to execute JPA example (given in Chapter 2) using J2SE . I am using MYSQL DB.
here is the code








Persistence.xml file



I have created all these above mentioned files but now i am not able to run it using J2SE
Please let me know how can i package it and run it using J2SE?
What will be mandatory lib/jar files that i require to run this code successfully?

Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

ItDoesntWorkIsUseless. What kind of error do you have ?


[My Blog]
All roads lead to JavaRanch
Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1000
    
    1

Hi

Putting my question in different way

I want to know the steps that i should follow to run a sample JPA code (as mentioned above in my post) in a J2SE eniv.
I have got all code ready but do not know how to run it for eg - what are the dependent lib/jars that i will require, what will be folder structure in which i should organize my above mentioned code etc ?

Thanks
Abhay
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
The folder structure is immaterial - choose whatever you like. The way you run your code is also immaterial - Ant, Maven, command line, from a script - whatever way you're comfortable with will work. There's nothing special about JPA in that regard.

The libraries you need are a) JPA, 2) the JDBC driver for your DB, and c) the libraries that make up whatever JPA implementation you're using (for example, OpenJPA, Hibernate or EclipseLink).


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can not run JPA sample example using J2SE
 
Similar Threads
persistence.xml file for MS SQL Server 2000
Problem with @Column annotation or corresponding xml tag if used with @Id annotation
SessionEdit pattern
One To One Mapping not working, plz help me out
Problem with refresh() method of EntityManamger in JPA