This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA /Hibernate mapping error  RSS feed

 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to persist a simple User object to an HSQLDB.The code performs a check to see if the User already exist and if not , then persists the User object.
The code is shown below :



The User class looks like :


and my persistence.xml :




When I try to run the application , I'm getting the following exception:

 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies for the double post.That wasn't intentional.Have already mailed Paul to remove the other post
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a table named USEERS in your database?
 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I realized where I was going wrong.In the query language , it's not the name of the table that one specifies , but rather the name of the class mapped to the table , hence in my case it was suppose to be :

The table name is specified as the object type , in this case User , not USERS(which is the table name)
 
Anoop K Thomas
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jeff mutonho wrote:I realized where I was going wrong.In the query language , it's not the name of the table that one specifies , but rather the name of the class mapped to the table , hence in my case it was suppose to be :

The table name is specified as the object type , in this case User , not USERS(which is the table name)



Thanks dude, i also encountered the same problem and you saved the day for me
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!