-->
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.  [ 1 post ] 
Author Message
 Post subject: sequence / ID generation problem
PostPosted: Tue Aug 11, 2009 1:33 pm 
Newbie

Joined: Tue Aug 11, 2009 1:17 pm
Posts: 1
Hi All,

We are using Postgres 8.X as DB, JBOSS 5 as app server. Most of our primary keys in tables are defined as serial type in DB and generated through Postgres sequence.


id defination in code looks like this

@Id
@SequenceGenerator(name="wilshire_seq", sequenceName="wilshire_transactions_id_seq")
@GeneratedValue(strategy =GenerationType.SEQUENCE,generator="wilshire_seq")

@Column(name = COLUMN_ID, unique = true, updatable = false, nullable = false)
private Integer id;

I tried different GenerationType, tried the code w/o using the SequenceGenerator annotation


The sequence generation used to work before with JBOSS 4.X. we recentely upgraded to JBOSS5 and sequence generation started giving following error.(Not sure if JBOSS5 has anything to do with this error)

select
currval('wilshire_transactions_id_seq')

2009-08-07 16:15:11,609 INFO [STDOUT] (http-127.0.0.1-8080-1) Hibernate:
select
nextval ('hibernate_sequence')

2009-08-07 16:15:11,609 WARN [org.hibernate.util.JDBCExceptionReporter] (http-127.0.0.1-8080-1) SQL Error: 0, SQLState: 42P01

2009-08-07 16:15:11,609 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-127.0.0.1-8080-1) ERROR: relation "hibernate_sequence" does not exist


Note currval is the right sequence name but for nextval it uses default hibernate_sequence. Not sure what I am missing?




Thanks
Yogini


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

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.