This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help setting up Hibernate  RSS feed

Ranch Hand
Posts: 39
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to add Hibernate JPA to my webapp, and I am having two problems.

1) There's an error message by the @Entity annotation on the Person.class. It says, "The table Person cannot be resolved"
2) I can't create a SessionFactory in the TestEntityManager class, so my tests never run. An exception is thrown when the EntityManager is created, but the SessionFactory is null. I'm not sure if the EntityManager exception is related to the null SessionFactory.

In regards to the Person.class error, I tried a few different solutions. I tried a couple from here: I don't want to turn off the validator, because that seems useful. I tried using the JPA tools to create tables from entities, but I got the following stack trace:

I also tried the solution from this link: I tried refreshing my connection to the DB using the JPA view, but the error didn't go away. I am able to ping by DB from the  view. I can also see my DB using pg admin. Do you have any other ideas on how I can create the Person table? What am I missing?

Now for the second problem. I tried to make a Util class for creating the SessionFactory, but I'm not sure where I have gone wrong. Can you take a look at my configurations and tell me if they are correct? Do you thin the problem is in another class, or am I missing another class? thanks.

Here's the credentials that I used for logging into postgres


Test Class. This is where the sessionFactory is set to null

This is where I implement the SessionFactory



This is the output when i run the test class
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!