-->
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.  [ 5 posts ] 
Author Message
 Post subject: problems persisting objects with db2
PostPosted: Tue Apr 04, 2006 8:38 am 
Newbie

Joined: Mon Mar 21, 2005 7:18 pm
Posts: 6
Hibernate version:
3.0

Mapping documents:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="connection.username">Korbinian</property>
<property name="connection.url">jdbc:db2:whiskyw</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="myeclipse.connection.profile">WhiskyW</property>
<property name="connection.password">daBRD_89</property>
<property name="connection.driver_class">COM.ibm.db2.jdbc.app.DB2Driver</property>
<property name="show_sql">true</property>
....vroius mapping files.....
<mapping resource="de/migrate/data/DB2/content/Zollverbrauchsteuer.hbm.xml"></mapping>

</session-factory>

Code between sessionFactory.openSession() and session.close():
for(Iterator iter = Zeilen.iterator(); iter.hasNext(); ) {

Element el = (Element) iter.next();
String _id = el.getAttributeValue("Verbrauchsteuer_ID");
String _name = el.getAttributeValue("Verbrauchsteuername");
int id = Integer.valueOf(_id).intValue();
Zollverbrauchsteuer zb = new Zollverbrauchsteuer();
zb.setId(id);
zb.setVerbrauchsteuer(_name);
DB2Session.save(zb);
DB2Session.flush();
System.out.println(_id + " " + _name);
}

Full stack trace of any exception that occurs:
none

Name and version of the database you are using:
IBM DB2 Express-C (identical to IBM DB2 Express v8.1 Fixpack Level 11 ~ v8.2)

The generated SQL (show_sql=true):
Hibernate: insert into WHISKYW.ZOLLVERBRAUCHSTEUER (VERBRAUCHSTEUER, ID) values (?, ?)
0 keine
Hibernate: insert into WHISKYW.ZOLLVERBRAUCHSTEUER (VERBRAUCHSTEUER, ID) values (?, ?)
1 Branntwein
... and so on, more identical ones

Debug level Hibernate log excerpt:
no log exerpt, no info thrown - thus no data persisted in the database!

Hi,

i trie to persist some objects wich are created by raw data out of a xml file. everything seems fine, no error or else, but no data is persisted in the table

the SQL queries however wont work if i copy them into the DB2 Order, it tells me error:

entering: insert into WHISKYW.ZOLLVERBRAUCHSTEUER (VERBRAUCHSTEUER, ID) values (?, ?)
0 keine

error reporting:
insert into WHISKYW.ZOLLVERBRAUCHSTEUER (VERBRAUCHSTEUER, ID) values (?, ?) 0 keine
DB21034E Der Befehl wurde als SQL-Anweisung verarbeitet, da es sich um keinen
gültigen Befehl des Befehlszeilenprozessors handelte. Während der
SQL-Verarbeitung wurde Folgendes ausgegeben:
SQL0104N Auf "R, ID) values (?, ?)" folgte das unerwartete Token "0". Zu den
möglichen Token gehören: ",". SQLSTATE=42601

SQL0104N Auf "R, ID) values (?, ?)" folgte das unerwartete Token "0". Zu den möglichen Token gehören: ", ".

Erklärung:

Bei dem Token, das auf "<text>" folgt, wurde ein Syntaxfehler in
der SQL-Anweisung oder der Eingabebefehlszeichenfolge für die Prozedur
SYSPROC.ADMIN_CMD festgestellt. Das Feld "<text>" enthält die 20
Zeichen der SQL-Anweisung oder der Eingabebefehlszeichenfolge für
die Prozedur SYSPROC.ADMIN_CMD, die dem ungültigen Token
unmittelbar vorangehen.

Als Hilfestellung wird im Feld SQLERRM des
SQL-Kommunikationsbereichs (SQLCA) eine Liste möglicher Token
"<tokenliste>" angezeigt. Bei der Zusammenstellung dieser Liste
wird davon ausgegangen, dass die Anweisung bis zum angegebenen Punkt
korrekt ist.

Die Anweisung kann nicht verarbeitet werden.

Benutzeraktion:

Überprüfen Sie die Anweisung im Bereich des ungültigen Token, und
korrigieren Sie sie.

sqlcode :> -104

sqlstate : 42601


what can this be ? - anyone here with same problems ? - Hibernate was stated to work with DB2 V8

Thanks for help,

Regards,

Korbinian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 9:43 am 
Newbie

Joined: Mon Mar 21, 2005 7:18 pm
Posts: 6
changed Hibernate version to 3.1.3 - still same problem


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 9:58 am 
Newbie

Joined: Mon Mar 21, 2005 7:18 pm
Posts: 6
this is whole log:

15:51:57,080 INFO Environment:479 - Hibernate 3.1.3
15:51:57,080 INFO Environment:509 - hibernate.properties not found
15:51:57,090 INFO Environment:525 - using CGLIB reflection optimizer
15:51:57,090 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
15:51:57,150 INFO Configuration:1308 - configuring from resource: /de/migrate/data/DB2/hibernate.cfg.xml
15:51:57,150 INFO Configuration:1285 - Configuration resource: /de/migrate/data/DB2/hibernate.cfg.xml
15:51:57,410 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Einstellungenkategorien.hbm.xml
15:51:57,550 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Einstellungenkategorien -> EINSTELLUNGENKATEGORIEN
15:51:57,631 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Artikelgeschmack.hbm.xml
15:51:57,671 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Artikelgeschmack -> ARTIKELGESCHMACK
15:51:57,671 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Artikelstamm.hbm.xml
15:51:57,701 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Artikelstamm -> ARTIKELSTAMM
15:51:57,701 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Artikelmengeneinheiten.hbm.xml
15:51:57,731 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Artikelmengeneinheiten -> ARTIKELMENGENEINHEITEN
15:51:57,731 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Einstellungengeografisch.hbm.xml
15:51:57,751 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Einstellungengeografisch -> EINSTELLUNGENGEOGRAFISCH
15:51:57,751 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Zolltaric.hbm.xml
15:51:57,771 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Zolltaric -> ZOLLTARIC
15:51:57,771 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/ArtikelstammArtikelgeschmack.hbm.xml
15:51:57,781 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.ArtikelstammArtikelgeschmack -> ARTIKELSTAMM_ARTIKELGESCHMACK
15:51:57,781 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Länder.hbm.xml
15:51:57,801 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Länder -> LÄNDER
15:51:57,801 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Artikelpreise.hbm.xml
15:51:57,811 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Artikelpreise -> ARTIKELPREISE
15:51:57,821 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Artikelhersteller.hbm.xml
15:51:57,831 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Artikelhersteller -> ARTIKELHERSTELLER
15:51:57,831 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/ArtikelArtikelpreise.hbm.xml
15:51:57,851 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.ArtikelArtikelpreise -> ARTIKEL_ARTIKELPREISE
15:51:57,851 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Artikel.hbm.xml
15:51:57,891 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Artikel -> ARTIKEL
15:51:57,901 INFO Configuration:469 - Reading mappings from resource: de/migrate/data/DB2/content/Zollverbrauchsteuer.hbm.xml
15:51:57,911 INFO HbmBinder:309 - Mapping class: de.migrate.data.DB2.content.Zollverbrauchsteuer -> ZOLLVERBRAUCHSTEUER
15:51:57,911 INFO Configuration:1419 - Configured SessionFactory: null
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Einstellungenkategorien.einstellungenkategoriens -> EINSTELLUNGENKATEGORIEN
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Einstellungenkategorien.artikels -> ARTIKEL
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Artikelgeschmack.artikelstammArtikelgeschmacks -> ARTIKELSTAMM_ARTIKELGESCHMACK
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Artikelstamm.artikelstammArtikelgeschmacks -> ARTIKELSTAMM_ARTIKELGESCHMACK
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Artikelstamm.artikels -> ARTIKEL
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Artikelmengeneinheiten.artikels -> ARTIKEL
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Einstellungengeografisch.einstellungengeografischs -> EINSTELLUNGENGEOGRAFISCH
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Einstellungengeografisch.artikelherstellers -> ARTIKELHERSTELLER
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Zolltaric.artikels -> ARTIKEL
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Länder.artikelpreises -> ARTIKELPREISE
15:51:57,911 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Artikelpreise.artikelArtikelpreises -> ARTIKEL_ARTIKELPREISE
15:51:57,921 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Artikelhersteller.artikelstamms -> ARTIKELSTAMM
15:51:57,921 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Artikel.artikelArtikelpreises -> ARTIKEL_ARTIKELPREISE
15:51:57,921 INFO HbmBinder:2349 - Mapping collection: de.migrate.data.DB2.content.Zollverbrauchsteuer.zolltarics -> ZOLLTARIC
15:51:58,071 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
15:51:58,071 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
15:51:58,071 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
15:51:58,171 INFO DriverManagerConnectionProvider:80 - using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:whiskyw
15:51:58,171 INFO DriverManagerConnectionProvider:86 - connection properties: {user=Korbinian, password=****}
15:51:58,772 INFO SettingsFactory:77 - RDBMS: DB2/NT, version: 08.02.0004
15:51:58,772 INFO SettingsFactory:78 - JDBC driver: IBM DB2 JDBC 2.0 Type 2, version: 08.02.0004
15:51:58,792 INFO Dialect:103 - Using dialect: org.hibernate.dialect.DB2Dialect
15:51:58,792 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
15:51:58,792 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
15:51:58,802 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
15:51:58,802 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
15:51:58,812 INFO SettingsFactory:144 - Scrollable result sets: enabled
15:51:58,822 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): disabled
15:51:58,822 INFO SettingsFactory:160 - Connection release mode: auto
15:51:58,822 INFO SettingsFactory:187 - Default batch fetch size: 1
15:51:58,822 INFO SettingsFactory:191 - Generate SQL with comments: disabled
15:51:58,822 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
15:51:58,822 INFO SettingsFactory:338 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
15:51:58,822 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
15:51:58,822 INFO SettingsFactory:203 - Query language substitutions: {}
15:51:58,822 INFO SettingsFactory:209 - Second-level cache: enabled
15:51:58,822 INFO SettingsFactory:213 - Query cache: disabled
15:51:58,822 INFO SettingsFactory:325 - Cache provider: org.hibernate.cache.EhCacheProvider
15:51:58,822 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
15:51:58,822 INFO SettingsFactory:237 - Structured second-level cache entries: disabled
15:51:58,822 INFO SettingsFactory:257 - Echoing all SQL to stdout
15:51:58,822 INFO SettingsFactory:264 - Statistics: disabled
15:51:58,822 INFO SettingsFactory:268 - Deleted entity synthetic identifier rollback: disabled
15:51:58,832 INFO SettingsFactory:283 - Default entity-mode: pojo
15:51:58,862 INFO SessionFactoryImpl:154 - building session factory
15:51:58,902 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/06dev/lib/Hibernate3.1.3/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
15:51:59,543 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
Entering...
Hibernate: insert into WHISKYW.ZOLLVERBRAUCHSTEUER (VERBRAUCHSTEUER, ID) values (?, ?)
0 keine
Hibernate: insert into WHISKYW.ZOLLVERBRAUCHSTEUER (VERBRAUCHSTEUER, ID) values (?, ?)
1 Branntwein
.... and so on


interesting thing is that the 2 values are wron placed - e.g. the String should not be at place of ID(integer) and vice versa

a correct working DB2 command would be

insert into WHISKYW.ZOLLVERBRAUCHSTEUER (VERBRAUCHSTEUER, ID) values ('Branntwein', 1)

so why doesnt hibernate do this ? - and why are postions mixed ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 10:02 am 
Newbie

Joined: Mon Mar 21, 2005 7:18 pm
Posts: 6
sorry, wrote sth wrong: each 2nd line is what should be put to hibernate - its jsut printed by system.out you can see in the code piece

so why has hibernate only values of (?,?) ???

i made a new object, assigned values to it and saved it and flushed the session...


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 2:13 am 
Newbie

Joined: Mon Jan 09, 2006 2:49 am
Posts: 3
Configure your log4j to set
org.hibernate.sql=DEBUG
org.hibernate.type=DEBUG

and you should see what Hibernate binds to those preparedstatements.


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