-->
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: sample doesnt run
PostPosted: Mon Jul 19, 2004 5:04 am 
Beginner
Beginner

Joined: Mon Jul 19, 2004 4:55 am
Posts: 34
hello
I begin with Hibernate and I try to run sample code, but I have a problem.
have all jar files, all xml fles and the porperties file but a bug persists.
I use MySQL dataBase and I have the following message when hibernate try to save:
Code:
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.4
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:mysql://odn001/test, hibernate.show_sql=true, hibernate.connection.password=odima, hibernate.connection.pool_size=1}
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Environment <clinit>
INFO: using java.io streams to persist binary types
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Configuration addClass
INFO: Mapping resource: org/hibernate/auction/AuctionItem.hbm.xml
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: org.hibernate.auction.AuctionItem -> AuctionItem
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Configuration addClass
INFO: Mapping resource: org/hibernate/auction/Bid.hbm.xml
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: org.hibernate.auction.Bid -> Bid
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Binder bindSubclass
INFO: Mapping subclass: org.hibernate.auction.BuyNow -> Bid
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Configuration addClass
INFO: Mapping resource: org/hibernate/auction/User.hbm.xml
19 juil. 2004 09:47:13 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: org.hibernate.auction.User -> AuctionUser
19 juil. 2004 09:47:14 net.sf.hibernate.util.ReflectHelper getBulkBean
INFO: reflection optimizer disabled for: org.hibernate.auction.Name, IllegalArgumentException: Cannot find matching method/constructor
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Binder bindCollectionSecondPass
INFO: Mapping collection: org.hibernate.auction.AuctionItem.bids -> Bid
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Binder bindCollectionSecondPass
INFO: Mapping collection: org.hibernate.auction.User.bids -> Bid
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Binder bindCollectionSecondPass
INFO: Mapping collection: org.hibernate.auction.User.auctions -> AuctionItem
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
19 juil. 2004 09:47:14 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximim outer join fetch depth: 1
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: false
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 1
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://odn001/test
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=odima}
19 juil. 2004 09:47:14 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): true
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: echoing all SQL to stdout
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {no='N', true=1, yes='Y', false=0}
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.ehcache.hibernate.Provider
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
19 juil. 2004 09:47:14 net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
19 juil. 2004 09:47:14 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JNDI name configured
19 juil. 2004 09:47:14 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
19 juil. 2004 09:47:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
19 juil. 2004 09:47:14 net.sf.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: Running hbm2ddl schema export
19 juil. 2004 09:47:14 net.sf.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: exporting generated schema to database
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 1
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://odn001/test
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=odima}
19 juil. 2004 09:47:14 net.sf.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: schema export complete
19 juil. 2004 09:47:14 net.sf.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:mysql://odn001/test
19 juil. 2004 09:47:14 net.sf.hibernate.cache.UpdateTimestampsCache <init>
INFO: starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
19 juil. 2004 09:47:14 net.sf.ehcache.config.Configurator configure
ATTENTION: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/eclipse-SDK-3.0-win32/eclipse/workspace/EssaiHibernate/WEB-INF/lib/ehcache-0.7.jar!/ehcache-failsafe.xml
19 juil. 2004 09:47:14 net.sf.ehcache.hibernate.Plugin <init>
ATTENTION: Could not find configuration for net.sf.hibernate.cache.UpdateTimestampsCache. Configuring using the defaultCache settings.
19 juil. 2004 09:47:14 net.sf.hibernate.cache.QueryCache <init>
INFO: starting query cache at region: net.sf.hibernate.cache.QueryCache
19 juil. 2004 09:47:14 net.sf.ehcache.hibernate.Plugin <init>
ATTENTION: Could not find configuration for net.sf.hibernate.cache.QueryCache. Configuring using the defaultCache settings.
Setting up some test data
set ok
username : oldirty password : null email : oldirty@hibernate.org id : 1 initial : ol' dirty bastard
Hibernate: insert into AuctionUser (userName, `password`, email, firstName, `initial`, lastName) values (?, ?, ?, ?, ?, ?)
java.lang.AbstractMethodError: com.mysql.jdbc.jdbc2.Connection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
   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:324)
   at net.sf.hibernate.util.GetGeneratedKeysHelper.prepareStatement(GetGeneratedKeysHelper.java:39)
   at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:246)
   at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
   at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:525)
   at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
   at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
   at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:932)
   at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
   at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
   at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
   at org.hibernate.auction.Main.createTestAuctions(Main.java:294)
   at org.hibernate.auction.Main.main(Main.java:369)
Exception in thread "main"


is there someone who see what's append?
Have I forgatten something ?
thanx


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 8:17 am 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
Could you please post the JDK version, mySQL version and JDBC driver version you are using ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 8:21 am 
Beginner
Beginner

Joined: Mon Jul 19, 2004 4:55 am
Posts: 34
jdk : j2sdk1.4.2_03
driver : mysql-connector-java-2.0.14-bin.jar
mysql : mysql 4.0.18-nt


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 8:56 am 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
Looks like you are trying to use a JDBC 3.0 feature (auto-generated keys) with a JDBC 2.1 only driver.

Try using Connector/J 3.0 or changing your key generation policy.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 3:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Or just diable use of getGeneratedKeys() in hibernate.properties


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.