Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark ""hibernate_sequence" does not exist" Watch ""hibernate_sequence" does not exist" New topic

"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

Joined: Feb 05, 2001
Posts: 17260

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


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:
Have you tried LearnNowOnline?
subject: "hibernate_sequence" does not exist