-->
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.  [ 3 posts ] 
Author Message
 Post subject: GENERATING SEQUENCES
PostPosted: Tue Dec 19, 2006 5:32 am 
Newbie

Joined: Tue Dec 19, 2006 5:25 am
Posts: 9
I am using PostgreSQL and Serial type for my sequence in my DB. But, when I try to insert a new object, the next exception is showed:

org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:75)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
at pojo.base._BaseRootDAO.save(_BaseRootDAO.java:629)
at pojo.base._BaseRootDAO$1.run(_BaseRootDAO.java:618)
at pojo.base._BaseRootDAO.run(_BaseRootDAO.java:755)
at pojo.base._BaseRootDAO.save(_BaseRootDAO.java:615)
at pojo.base.BaseProjectDAO.save(BaseProjectDAO.java:109)
at Test.main(Test.java:36)


The syntax of my hbm is like that:

<generator class="sequence"/>

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 19, 2006 5:34 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:13 pm
Posts: 32
Location: Spain (GU)
You should use the PostgreSQL syntax:

<generator class="sequence">
<param name="sequence">name_of_sequence</param>
</generator>

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 19, 2006 6:22 am 
Newbie

Joined: Tue Dec 19, 2006 5:25 am
Posts: 9
it runs!, many thanks.

Best regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.