users@glassfish.java.net

Old bug reappearing? Sequence issue with PostgreSQL

From: <glassfish_at_javadesktop.org>
Date: Tue, 05 Jun 2007 04:47:28 PDT

I'm experiencing an error that seemingly has already been fixed:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=283

I've worked with 3 other entities without problems, but now when I add a new entity, I get the following stack trace:

[#|2007-06-05T13:24:15.890+0200|WARNING|sun-appserver9.1|oracle.toplink.essentials.session.file:/C:/Program%20Files/Java/glassfish/domains/bluebricks/applications/j2ee-apps/bbsmsear/bbsms_ejb_jar/-EntityService|_ThreadID=38;_ThreadName=Thread-50;_RequestID=26a0b7cf-d468-4e26-bb93-d365427611e3;|
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b41d-beta2 (04/23/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: relation "sequence" does not exist
Error Code: 0
Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
        bind => [50, bb_message_id_seq]
Query: DataModifyQuery()
        at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:296)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:639)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:688)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:477)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:437)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:675)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:213)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:199)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelectCall(DatasourceCallQueryMechanism.java:242)
        at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelect(DatasourceCallQueryMechanism.java:222)
        at oracle.toplink.essentials.queryframework.DataModifyQuery.executeDatabaseQuery(DataModifyQuery.java:71)
        at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:1815)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
        at oracle.toplink.essentials.sequencing.QuerySequence.update(QuerySequence.java:329)
        at oracle.toplink.essentials.sequencing.QuerySequence.updateAndSelectSequence(QuerySequence.java:268)
        at oracle.toplink.essentials.sequencing.StandardSequence.getGeneratedVector(StandardSequence.java:81)
        at oracle.toplink.essentials.sequencing.DefaultSequence.getGeneratedVector(DefaultSequence.java:153)
        at oracle.toplink.essentials.sequencing.Sequence.getGeneratedVector(Sequence.java:266)
        at oracle.toplink.essentials.internal.sequencing.SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:404)
        at oracle.toplink.essentials.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:832)
        at oracle.toplink.essentials.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:95)
        at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:225)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.assignSequenceNumber(UnitOfWorkImpl.java:341)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:3255)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:323)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3206)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:190)
        at com.sun.enterprise.util.EntityManagerWrapper.persist(EntityManagerWrapper.java:449)
        at com.bluebricks.net.sql.beans.EntityServiceBean.createRecord(EntityServiceBean.java:38)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1055)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:163)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2846)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3930)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:184)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:114)
        at $Proxy71.createRecord(Unknown Source)
        at com.bluebricks.net.sql.DbConnSQL.insert(DbConnSQL.java:87)
        at com.bluebricks.net.DbRecord.write(DbRecord.java:117)
        at com.bluebricks.sms.msg.SMS.logMsg(SMS.java:199)
        at com.bluebricks.sms.SMSWorker.doWork(SMSWorker.java:101)
        at com.bluebricks.sms.SMSWorker.run(SMSWorker.java:142)
        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "sequence" does not exist
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection$StatementHandler.invoke(AbstractJdbc23PooledConnection.java:471)
        at $Proxy26.executeUpdate(Unknown Source)
        at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:632)
        ... 47 more

The primary key in this table is equal to the other tables. It is a serial and is bound to the the bb_message_id_seq sequence.

The xml descriptor for this entity looks like this:
        <entity class="com.bluebricks.net.entity.MobileMessage" access="PROPERTY">
                <table name="bb_message"/>
                <!-- Sequence generator for primary key -->
                <sequence-generator name="Msg_Gen" sequence-name="bb_message_id_seq"/>
                <attributes>
                        <!-- Primary key -->
                        <id name="id">
                                <column name="id" unique="true" nullable="false" column-definition="integer"/>
                                <generated-value strategy="SEQUENCE" generator="Msg_Gen"/>
                        </id>
                </attributes>
        </entity>

I'm using build b41d-beta2 and PostgreSQL 8.2

Regards
Marius Waldal
[Message sent by forum member 'mariusw' (mariusw)]

http://forums.java.net/jive/thread.jspa?messageID=220524