JPA, Glassfish and Eclipse

Today I’ve been wrestling with Glassfish and Eclipse, in particular the part where I try and persist Entity objects to the database. I admit that I started almost from scratch here with very little previous experience, but I still expected it to be easier.

Here is the issue: The DB that Glassfish uses for its JPA is NOT NECESSARILY the same DB you setup in Eclipse, when you choose a Data Source under the project’s “Java Persistance” property pane. I automatically assumed that Glassfish would play nicely with Eclipse and use the same settings, but it is not true.

… which is why when I tried to persist Entities to the Glassfish database, it couldn’t find the table I had set up inside my MySQL datasource. Instead, it was looking inside the default Glassfish datasource, which is located here:

jdbc:derby://localhost:1527/sun-appserv-samples

In the end, I wanted to get into writing beans fast, so I set Eclipse to talk to this DB instead. It is extremely important that you get the correct Schema also, which is accomplished by logging in as “APP”:


Username: APP
Password: APP

For more information, have a look at this page on the Glassfish Wiki.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Slashdot
  • Twitter

Tags: , , ,

One Response to “JPA, Glassfish and Eclipse”

  1. I am regular visitor, how are you everybody? This post posted at this web site is really nice.|

Leave a Reply