-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: "hibernate_sequence" does not exist
PostPosted: Sun Mar 14, 2010 5:09 pm 
Newbie

Joined: Sun Mar 14, 2010 5:28 am
Posts: 1
Code:
org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist
  Position: 17
   at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
   at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
......


I got this exception trying execute (persist) the below code snippets:
Code:
@Entity
@Table(name = "users")
public class User {
private Long id;
private Set<String> roles = new HashSet<String>();
@Id
   @GeneratedValue()
   public Integer getId() {
      return id;
   }
// more getters & setters
@CollectionOfElements(targetElement = java.lang.String.class)
   @JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "user_id"))
   @Column(name = "role")   
   public Set<String> getRoles() {
      return roles;
   }
...

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


Top
 Profile  
 
 Post subject: Re: "hibernate_sequence" does not exist
PostPosted: Mon Mar 15, 2010 1:42 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
Try to execute schema export, you will get a script to generate the sequence.
Code:
Configuration cfg = new Configuration().configure();
SchemaExport se = new SchemaExport(cfg);
se.setDelimiter(";");
se.setOutputFile("schema.sql");
se.create(true, false); // (script, export)


Code:

create sequence hibernate_sequence;


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.