-->
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: unable to insert record into maxdb. Failing at sequence gen
PostPosted: Fri Apr 01, 2005 12:42 pm 
Newbie

Joined: Fri Apr 01, 2005 12:28 pm
Posts: 1
I am trying to insert into a table with two columns: one the primary key ( an int ) and a description field. It looks like there is some problem( of course with my configuration ) with the sequence generation. I tried identity, native and sequence. Well, identity failed for obvious reasons. but could not find the failure reason for native.

It would be very helpful, if you can point me in the right direction to use hibernate with MaxDb 7.5.

Thank much in advance.

P.S: I used the same table and mapping file in mysql and seems to be working fine.


Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.7c
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping package="com.netbytel.evps.reporting.cdrprocessor.hibernate">
<class name="CheckpointT" table="checkpoint_t">
<id name="checkpointId" column="checkpoint_id" type="integer">
<generator class="native"/>
</id>
<property name="checkpointName" column="checkpoint_name" type="string" not-null="true" />
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

Session session = HibernateSessionFactory.currentSession();
Transaction tx = session.beginTransaction();
CheckpointT ckpt = new CheckpointT();
ckpt.setCheckpointName("MaxDbCkptName");
session.save(ckpt);
tx.commit();

Full stack trace of any exception that occurs:
11:09:27,125 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
11:09:27,125 DEBUG [SQL] select sequences.nextval from dual
Hibernate: select sequences.nextval from dual
11:09:27,140 DEBUG [BatcherImpl] preparing statement
11:09:27,203 DEBUG [JDBCExceptionReporter] SQL Exception
com.sap.dbtech.jdbc.exceptions.DatabaseException: [-4020] (at 8): Unknown sequence name:SEQUENCES
at com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
at com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:768)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:434)
at com.sap.dbtech.jdbc.CallableStatementSapDB.sendCommand(CallableStatementSapDB.java:1501)
at com.sap.dbtech.jdbc.StatementSapDB.sendSQL(StatementSapDB.java:725)
at com.sap.dbtech.jdbc.CallableStatementSapDB.doParse(CallableStatementSapDB.java:227)
at com.sap.dbtech.jdbc.CallableStatementSapDB.constructor(CallableStatementSapDB.java:178)
at com.sap.dbtech.jdbc.CallableStatementSapDB.<init>(CallableStatementSapDB.java:80)
at com.sap.dbtech.jdbc.ConnectionSapDB.prepareStatement(ConnectionSapDB.java:660)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:62)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:57)
at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:62)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:774)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)
at com.netbytel.evps.test.MaxDbTest.main(MaxDbTest.java:32)
11:09:27,203 WARN [JDBCExceptionReporter] SQL Error: -4020, SQLState: I4020
11:09:27,203 ERROR [JDBCExceptionReporter] [-4020] (at 8): Unknown sequence name:SEQUENCES
11:09:27,218 DEBUG [JDBCExceptionReporter] Could not save object
com.sap.dbtech.jdbc.exceptions.DatabaseException: [-4020] (at 8): Unknown sequence name:SEQUENCES
at com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
at com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:768)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:434)
at com.sap.dbtech.jdbc.CallableStatementSapDB.sendCommand(CallableStatementSapDB.java:1501)
at com.sap.dbtech.jdbc.StatementSapDB.sendSQL(StatementSapDB.java:725)
at com.sap.dbtech.jdbc.CallableStatementSapDB.doParse(CallableStatementSapDB.java:227)
at com.sap.dbtech.jdbc.CallableStatementSapDB.constructor(CallableStatementSapDB.java:178)
at com.sap.dbtech.jdbc.CallableStatementSapDB.<init>(CallableStatementSapDB.java:80)
at com.sap.dbtech.jdbc.ConnectionSapDB.prepareStatement(ConnectionSapDB.java:660)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:62)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:57)
at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:62)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:774)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)
at com.netbytel.evps.test.MaxDbTest.main(MaxDbTest.java:32)
11:09:27,218 WARN [JDBCExceptionReporter] SQL Error: -4020, SQLState: I4020
11:09:27,218 ERROR [JDBCExceptionReporter] [-4020] (at 8): Unknown sequence name:SEQUENCES
net.sf.hibernate.exception.GenericJDBCException: Could not save object
at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:81)
at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:792)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)
at com.netbytel.evps.test.MaxDbTest.main(MaxDbTest.java:32)
Caused by: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-4020] (at 8): Unknown sequence name:SEQUENCES
at com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
at com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:768)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:434)
at com.sap.dbtech.jdbc.CallableStatementSapDB.sendCommand(CallableStatementSapDB.java:1501)
at com.sap.dbtech.jdbc.StatementSapDB.sendSQL(StatementSapDB.java:725)
at com.sap.dbtech.jdbc.CallableStatementSapDB.doParse(CallableStatementSapDB.java:227)
at com.sap.dbtech.jdbc.CallableStatementSapDB.constructor(CallableStatementSapDB.java:178)
at com.sap.dbtech.jdbc.CallableStatementSapDB.<init>(CallableStatementSapDB.java:80)
at com.sap.dbtech.jdbc.ConnectionSapDB.prepareStatement(ConnectionSapDB.java:660)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:62)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:57)
at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:62)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:774)
... 2 more
Name and version of the database you are using:
MaxDb 7.5
The generated SQL (show_sql=true):
Hibernate: select sequences.nextval from dual
Debug level Hibernate log excerpt:

11:09:27,046 DEBUG [SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
11:09:27,062 DEBUG [SessionFactoryObjectFactory] registered: 2c9189d402fe86210102fe8627060000 (unnamed)
11:09:27,062 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
11:09:27,062 DEBUG [SessionFactoryImpl] instantiated session factory
11:09:27,125 DEBUG [SessionImpl] opened session
11:09:27,125 DEBUG [JDBCTransaction] begin
11:09:27,125 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
11:09:27,125 DEBUG [DriverManagerConnectionProvider] using pooled JDBC connection, pool size: 0
11:09:27,125 DEBUG [JDBCTransaction] current autocommit status:false
11:09:27,125 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
11:09:27,125 DEBUG [SQL] select sequences.nextval from dual
Hibernate: select sequences.nextval from dual
11:09:27,140 DEBUG [BatcherImpl] preparing statement
11:09:27,203 DEBUG [JDBCExceptionReporter] SQL Exception
com.sap.dbtech.jdbc.exceptions.DatabaseException: [-4020] (at 8): Unknown sequence name:SEQUENCES
at com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
at com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:768)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:434)
at com.sap.dbtech.jdbc.CallableStatementSapDB.sendCommand(CallableStatementSapDB.java:1501)
at com.sap.dbtech.jdbc.StatementSapDB.sendSQL(StatementSapDB.java:725)
at com.sap.dbtech.jdbc.CallableStatementSapDB.doParse(CallableStatementSapDB.java:227)
at com.sap.dbtech.jdbc.CallableStatementSapDB.constructor(CallableStatementSapDB.java:178)
at com.sap.dbtech.jdbc.CallableStatementSapDB.<init>(CallableStatementSapDB.java:80)
at com.sap.dbtech.jdbc.ConnectionSapDB.prepareStatement(ConnectionSapDB.java:660)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:62)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:57)
at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:62)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:774)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)
at com.netbytel.evps.test.MaxDbTest.main(MaxDbTest.java:32)
11:09:27,203 WARN [JDBCExceptionReporter] SQL Error: -4020, SQLState: I4020
11:09:27,203 ERROR [JDBCExceptionReporter] [-4020] (at 8): Unknown sequence name:SEQUENCES
11:09:27,218 DEBUG [JDBCExceptionReporter] Could not save object
com.sap.dbtech.jdbc.exceptions.DatabaseException: [-4020] (at 8): Unknown sequence name:SEQUENCES
at com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
at com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:768)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:434)
at com.sap.dbtech.jdbc.CallableStatementSapDB.sendCommand(CallableStatementSapDB.java:1501)
at com.sap.dbtech.jdbc.StatementSapDB.sendSQL(StatementSapDB.java:725)
at com.sap.dbtech.jdbc.CallableStatementSapDB.doParse(CallableStatementSapDB.java:227)
at com.sap.dbtech.jdbc.CallableStatementSapDB.constructor(CallableStatementSapDB.java:178)
at com.sap.dbtech.jdbc.CallableStatementSapDB.<init>(CallableStatementSapDB.java:80)
at com.sap.dbtech.jdbc.ConnectionSapDB.prepareStatement(ConnectionSapDB.java:660)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:62)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:57)
at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:62)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:774)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)
at com.netbytel.evps.test.MaxDbTest.main(MaxDbTest.java:32)
11:09:27,218 WARN [JDBCExceptionReporter] SQL Error: -4020, SQLState: I4020
11:09:27,218 ERROR [JDBCExceptionReporter] [-4020] (at 8): Unknown sequence name:SEQUENCES
net.sf.hibernate.exception.GenericJDBCException: Could not save object
at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:81)
at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:792)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)
at com.netbytel.evps.test.MaxDbTest.main(MaxDbTest.java:32)
Caused by: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-4020] (at 8): Unknown sequence name:SEQUENCES
at com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
at com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:768)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:434)
at com.sap.dbtech.jdbc.CallableStatementSapDB.sendCommand(CallableStatementSapDB.java:1501)
at com.sap.dbtech.jdbc.StatementSapDB.sendSQL(StatementSapDB.java:725)
at com.sap.dbtech.jdbc.CallableStatementSapDB.doParse(CallableStatementSapDB.java:227)
at com.sap.dbtech.jdbc.CallableStatementSapDB.constructor(CallableStatementSapDB.java:178)
at com.sap.dbtech.jdbc.CallableStatementSapDB.<init>(CallableStatementSapDB.java:80)
at com.sap.dbtech.jdbc.ConnectionSapDB.prepareStatement(ConnectionSapDB.java:660)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:62)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:57)
at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:62)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:774)
... 2 more

Code:
Code:


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.