-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problem with SequenceStyleGenerator under Postgres
PostPosted: Wed Apr 15, 2009 9:45 am 
Beginner
Beginner

Joined: Fri Aug 22, 2008 5:49 am
Posts: 22
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.3.1.GA
Full stack trace of any exception that occurs:
Code:
ERROR 15:38:06 0    could not read a hi value (TableStructure.java:140)
org.postgresql.util.PSQLException: ERROR: syntax error at or near "id_val"
   at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
   at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
   at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:437)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:257)
   at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
   at org.hibernate.id.enhanced.TableStructure.doWorkInCurrentTransaction(TableStructure.java:130)
   at org.hibernate.engine.TransactionHelper$1Work.doWork(TransactionHelper.java:61)
   at org.hibernate.engine.transaction.Isolater$JdbcDelegate.delegateWork(Isolater.java:211)
   at org.hibernate.engine.transaction.Isolater.doIsolatedWork(Isolater.java:67)
   at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:74)
   at org.hibernate.id.enhanced.TableStructure$1.getNextValue(TableStructure.java:98)
   at org.hibernate.id.enhanced.OptimizerFactory$PooledOptimizer.generate(OptimizerFactory.java:197)
   at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:181)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)
   at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
   at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)


Name and version of the database you are using:
PostgreSQL 8.3
The generated SQL (show_sql=true):
select next_val id_val from hibernate_sequence for update;


We using org.hibernate.id.enhanced.SequenceStyleGenerator for IDGenerator. And get the error, that "syntax error at or near "id_val", and we found this from Postgres dokumentation,

In the SQL92 standard, the optional keyword AS is just noise and can be omitted without affecting the meaning. The PostgreSQL parser requires this keyword when renaming output columns because the type extensibility features lead to parsing ambiguities in this context. AS is optional in FROM items, however.

The problem is in the constructor by the class org.hibernate.id.enhanced.TableStructure.

Can you tell us, how can we fix this problem, thank you.


Top
 Profile  
 
 Post subject: Re: Problem with SequenceStyleGenerator under Postgres
PostPosted: Tue May 05, 2009 9:31 am 
Beginner
Beginner

Joined: Fri Aug 22, 2008 5:49 am
Posts: 22
I have create a jira task for this bug:

http://opensource.atlassian.com/project ... e/HHH-3880


Top
 Profile  
 
 Post subject: Re: Problem with SequenceStyleGenerator under Postgres
PostPosted: Tue May 05, 2009 3:11 pm 
Newbie

Joined: Mon May 04, 2009 5:23 pm
Posts: 1
Hi there,

It would have been nice to see your mapping file, but heres how i do it with Postgress:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class dynamic-insert="false" dynamic-update="false" mutable="true" name="dk.detkun.db.Smoking" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="smoking">
<id column="id" name="id">
<generator class="sequence">
<param name="sequence">smoking_id_seq</param>
</generator>
</id>
<property name="smoking" type="string"/>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: Re: Problem with SequenceStyleGenerator under Postgres
PostPosted: Fri May 08, 2009 6:46 am 
Beginner
Beginner

Joined: Fri Aug 22, 2008 5:49 am
Posts: 22
hello, we use hibernate annotation, so i don't have mapping file. And the problem is in the class org.hibernate.id.enhanced.TableStructure.


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