aspose file tools*
The moose likes Object Relational Mapping and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query" Watch "Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query" New topic
Author

Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query

Gabriela Rios
Ranch Hand

Joined: Feb 27, 2008
Posts: 32
Hello all,

I have a question/problem. I have a class with my User object. If I only have the columns as variables, everything works as expected. If I add another variable that is not in the database, I get "Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query". I thought I could add the other variables without mapping them to the table (cardNumber, balance). I was wrong How can I add them to my class? Thanks.


Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17256
    
    6

By default all properties are mapped with Annotations. So if you have a property that is not in the database you have to annotate it with @Transient.

Moving this to the ORM forum. This is not Spring related.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Gabriela Rios
Ranch Hand

Joined: Feb 27, 2008
Posts: 32
Thanks! My bad. I'll be more careful next time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query