Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JPA Pro 2 (2nd edition) chapter 2 persistence.xml needs to be updated

Posts: 1924
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,  I am reading chapter 2 of this text book.
I think the persistence.xm file should be updated into this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns=""; xmlns:xsi=""; xsi:schemaLocation="">;
<persistence-unit name="EmployeeService">
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/murach_jpa" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="sesame" />
Make sure you have mysql-connector-java-5.1.39-bin.jar in your build path.
Assume you have download MySQL and assume there is a database called murach_jpa.
I am using this database created in Murach's JSP/Servlet book.

Saloon Keeper
Posts: 22286
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If would have been better if you'd use the "Code" rather than the "Quote" option on that sample. The code tags preserve spacing and formatting in sample XML and Java.

It would have been even better if you'd indicating what precisely you changed from the book's sample persistence.xml.

If if was the mysql jdbc jar version, that's not usually essential, since the mysql jdbc driver's basic functionality isn't that different between most of its versions.
Himai Minh
Posts: 1924
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Tim.
Thanks for pointing out. I recommend to download the latest version of mySQL connector.
I added the <class>  and <properties>, which do not exist in the original code.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic