• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Error in generating Sequence

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I originally posted this on the jboss seam board as I ran across this error on a seam test example, but it seems it's more generally applicable to ejb3 entity beans not generating sql that postgres can understand. I'll post my message below, all replies are appreciated.

I'm going through the hello world example from the seam book, and I'm getting an error I cannot resolve, that with an auto generated sql statement, that's not valid for postgres 8.1, the database I'm on. Here's my error:

......
17:40:31,370 INFO [STDOUT] Hibernate: select next value for person_id_seq from dual_person_id_seq
17:40:31,394 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 42601
17:40:31,394 ERROR [JDBCExceptionReporter] ERROR: syntax error at or near "value"
17:40:31,396 FATAL [application] javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get next sequence value
javax.faces.el.EvaluationException: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get next sequence value

Here's the table definition
- create table Person (id bigint not null, name varchar(255), primary key (id))
- create table dual_person_id_seq (zero integer)
- create sequence person_id_seq start with 1 increment by 1

and here's the entity bean:

@Entity
@Table(name="person",schema="cgda_dad")
@SequenceGenerator(name="person_sequence", sequenceName="person_id_seq")
public class Person implements Serializable {

private long id;
private String name;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="person_sequence")
public long getId() { return id;}
public void setId(long id) { this.id = id; }

public String getName() { return name; }
public void setName(String name) { this.name = name; }
}


How do I get it to generate a valid sql statement for postgres?
If i try to insert values in database directly then it works fine.


please Help Me.
with Regards

Amar Deep Singh
amardeep.100webspace.net
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic