-->
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: Simple test dosen't work
PostPosted: Wed Mar 24, 2004 3:51 am 
Newbie

Joined: Wed Mar 24, 2004 3:46 am
Posts: 1
Hi

I have a simple table (DB2) such as...

create table test (task varchar(255) not null, name varchar(255))
alter table dba.test add constraint "testpk" primary key ("TASK")

And a mapping file such as...


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

<hibernate-mapping>
<class name="com.olasme.domain.Test" table="TEST">
<id name="task" type="string" unsaved-value="null">
<column name="task" sql-type="char(100)" not-null="true"/>
<generator class="uuid.hex"/>
</id>
<property name="name">
<column name="name" sql-type="char(255)" not-null="true" />
</property>
</class>
</hibernate-mapping>



And a method that does a save...

public static Savable save(Savable savable) throws Exception {
Configuration configuration = new Configuration().addClass(savable.getClass());
SessionFactory sessionFactory = configuration.buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
session.save(savable);
transaction.commit();
session.close();
return savable;
}




This is the LOG.


19:49:12,922 INFO Environment:432).null(Unknown Source - Hibernate 2.1.1
19:49:12,938 INFO Environment:466).null(Unknown Source - loaded properties from resource hibernate.properties: {hibernate.connection.username=dba, hibernate.connection.password=Xk32Yy, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect, hibernate.connection.url=jdbc:db2:dbserver, hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver}
19:49:12,953 INFO Environment:481).null(Unknown Source - using CGLIB reflection optimizer
19:49:12,984 INFO Configuration:318 - Mapping resource: com/olasme/domain/Test.hbm.xml
19:49:13,859 INFO Binder:225 - Mapping class: com.olasme.domain.Test -> TEST
19:49:14,016 INFO Configuration:584 - processing one-to-many association mappings
19:49:14,016 INFO Configuration:593 - processing one-to-one association property references
19:49:14,016 INFO Configuration:618 - processing foreign key constraints
19:49:14,078 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.DB2Dialect
19:49:14,094 INFO SettingsFactory:62 - Use outer join fetching: true
19:49:14,109 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
19:49:14,109 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
19:49:14,906 INFO DriverManagerConnectionProvider:71 - using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:dbserver
19:49:14,906 INFO DriverManagerConnectionProvider:72 - connection properties: {user=dba, password=Xk32Yy}
19:49:14,938 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
19:49:15,516 INFO SettingsFactory:89 - Use scrollable result sets: true
19:49:15,516 INFO SettingsFactory:99 - Query language substitutions: {}
19:49:15,516 INFO SettingsFactory:110 - cache provider: net.sf.ehcache.hibernate.Provider
19:49:15,859 INFO Configuration:1057 - instantiating and configuring caches
19:49:16,234 INFO SessionFactoryImpl:119 - building session factory
19:49:17,016 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
19:49:17,188 DEBUG SQL:223 - insert into TEST (name, task) values (?, ?)
19:49:17,250 WARN JDBCExceptionReporter:38 - SQL Error: -204, SQLState: 42S02
19:49:17,250 ERROR JDBCExceptionReporter:46 - [IBM][CLI Driver][DB2/NT] SQL0204N "DBA.TEST" is an undefined name. SQLSTATE=42704

19:49:17,250 ERROR JDBCExceptionReporter:38 - could not insert: [com.olasme.domain.Test#402881b3fb7bd82c00fb7bd830e40001]
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0204N "DBA.TEST" is an undefined name. SQLSTATE=42704

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:469)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:443)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at com.olasme.domain.DataWriter.save(DataWriter.java:28)
at com.olasme.domain.PaymentTypeTest.main(PaymentTypeTest.java:14)
19:49:17,250 ERROR SessionImpl:2269 - Could not synchronize database state with session
net.sf.hibernate.JDBCException: could not insert: [com.olasme.domain.Test#402881b3fb7bd82c00fb7bd830e40001]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:479)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:443)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at com.olasme.domain.DataWriter.save(DataWriter.java:28)
at com.olasme.domain.PaymentTypeTest.main(PaymentTypeTest.java:14)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0204N "DBA.TEST" is an undefined name. SQLSTATE=42704

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:469)
... 8 more
Exception in thread "main" net.sf.hibernate.JDBCException: could not insert: [com.olasme.domain.Test#402881b3fb7bd82c00fb7bd830e40001]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:479)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:443)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at com.olasme.domain.DataWriter.save(DataWriter.java:28)
at com.olasme.domain.PaymentTypeTest.main(PaymentTypeTest.java:14)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0204N "DBA.TEST" is an undefined name. SQLSTATE=42704

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:469)
... 8 more



Any help is appreciated.
Cheers
Srirang


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.