permaculture playing cards*
The moose likes Object Relational Mapping and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark ""hibernate_sequence" does not exist" Watch ""hibernate_sequence" does not exist" New topic
Author

"hibernate_sequence" does not exist

ahmed yehia
Ranch Hand

Joined: Apr 22, 2006
Posts: 424


I got this exception trying execute (persist) the below code snippets:

Postgres tables are:
1- users (id, ...)
2- user_roles(user_id, role)
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Because you are using @GeneratedValue()

It will look for how the database that you are using generates ids. For MySql or HSQSL, there are increment fields that automatically increment. In Postgres or Oracle, they use sequence tables. Since you didn't specify a sequence table name, it will look for a sequence table named hibernate_sequence and use it for default. So you probably don't have such a sequence table in your database and now you get that error.

Either add a hibernate_sequence or
your own sequence table and use the annotations to name your sequence table that you have.

Hope that helps

Mark


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

Joined: Apr 22, 2006
Posts: 424
Thanks Mark, I also got it working using:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "hibernate_sequence" does not exist