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

Need help setting up Hibernate

Ranch Hand
Posts: 39
Mac Java 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
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic