-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with Getting start Hibernate3
PostPosted: Mon Jun 20, 2005 12:39 pm 
Newbie

Joined: Tue May 10, 2005 10:54 am
Posts: 16
Location: Italy
Hi, I'm new with Hibernate.
I've Hibernate 2.1, I've just used it, and it's all ok.
Now I want migrate in Hibernate 3, so I've download it. I've put my jdbc driver, mysql-connector-java-3.1.7-bin, in lib directory.
I've set hibernate.properties for mysql :

Quote:
## MySQL

hibernate.dialect org.hibernate.dialect.MySQLDialect
#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://localhost/progetto
hibernate.connection.username root
hibernate.connection.password


and from prompt "build eg".
I've a problem with chekstyle in build.xml, so I've put in lib diretory checkstyle-3.5.
But I've other problems

Quote:
C:\hibernate-3.0>java -cp "lib/ant-launcher-1.6.3.jar" org.apache.tools.ant.launch.Launcher -lib lib
-Ddriver.jar=C:\jdbc\mysql-connector-java-3.1.7-bin.jar eg
Buildfile: build.xml
[taskdef] Could not load definitions from resource clovertasks. It could not be found.

eg:
[echo] remember to place your JDBC driver in the lib directory
[java] 18:34:25,275 INFO Environment:464 - Hibernate 3.0.5
[java] 18:34:25,315 INFO Environment:482 - loaded properties from resource hibernate.propertie
s: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimize
r=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fet
ch_depth=1, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_bin
ary=true, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_ali
as=pool1, hibernate.connection.username=root, hibernate.cache.region_prefix=hibernate.test, hibernat
e.connection.url=jdbc:mysql://localhost/progetto, hibernate.connection.password=****, hibernate.jdbc
.batch_versioned_data=true, hibernate.connection.pool_size=1}
[java] 18:34:25,335 INFO Environment:509 - using java.io streams to persist binary types
[java] 18:34:25,335 INFO Environment:510 - using CGLIB reflection optimizer
[java] 18:34:25,345 INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling
[java] 18:34:25,636 INFO Configuration:464 - Mapping resource: org/hibernate/auction/AuctionIt
em.hbm.xml
[java] 18:34:27,008 INFO HbmBinder:260 - Mapping class: org.hibernate.auction.AuctionItem -> A
uctionItem
[java] 18:34:27,378 INFO Configuration:464 - Mapping resource: org/hibernate/auction/Bid.hbm.x
ml
[java] 18:34:27,538 INFO HbmBinder:260 - Mapping class: org.hibernate.auction.Bid -> Bid
[java] 18:34:27,658 INFO HbmBinder:737 - Mapping subclass: org.hibernate.auction.BuyNow -> Bid

[java] 18:34:27,679 INFO Configuration:464 - Mapping resource: org/hibernate/auction/User.hbm.
xml
[java] 18:34:27,809 INFO HbmBinder:260 - Mapping class: org.hibernate.auction.User -> AuctionU
ser
[java] 18:34:27,829 INFO Configuration:875 - processing extends queue
[java] 18:34:27,829 INFO Configuration:879 - processing collection mappings
[java] 18:34:27,839 INFO HbmBinder:2041 - Mapping collection: org.hibernate.auction.AuctionIte
m.bids -> Bid
[java] 18:34:27,839 INFO HbmBinder:2041 - Mapping collection: org.hibernate.auction.User.bids
-> Bid
[java] 18:34:27,839 INFO HbmBinder:2041 - Mapping collection: org.hibernate.auction.User.aucti
ons -> AuctionItem
[java] 18:34:27,849 INFO Configuration:888 - processing association property references
[java] 18:34:27,849 INFO Configuration:917 - processing foreign key constraints
[java] 18:34:28,410 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connect
ion pool (not for production use!)
[java] 18:34:28,410 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size:
1
[java] 18:34:28,410 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
[java] 18:34:28,440 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Dri
ver at URL: jdbc:mysql://localhost/progetto
[java] 18:34:28,440 INFO DriverManagerConnectionProvider:86 - connection properties: {user=roo
t, password=****}
[java] 18:34:29,331 INFO SettingsFactory:77 - RDBMS: MySQL, version: 3.23.53-max-nt
[java] 18:34:29,331 INFO SettingsFactory:78 - JDBC driver: MySQL-AB JDBC Driver, version: mysq
l-connector-java-3.1.7 ( $Date: 2005/01/25 19:11:41 $, $Revision: 1.27.4.54 $ )
[java] 18:34:29,651 INFO Dialect:92 - Using dialect: org.hibernate.dialect.MySQLDialect
[java] 18:34:29,681 INFO TransactionFactoryFactory:31 - Using default transaction strategy (di
rect JDBC transactions)
[java] 18:34:29,701 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup conf
igured (in JTA environment, use of read-write or transactional second-level cache is not recommended
)
[java] 18:34:29,701 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disa
bled
[java] 18:34:29,711 INFO SettingsFactory:129 - Automatic session close at end of transaction:
disabled
[java] 18:34:29,711 INFO SettingsFactory:136 - JDBC batch size: 15
[java] 18:34:29,721 INFO SettingsFactory:139 - JDBC batch updates for versioned data: enabled
[java] 18:34:29,731 INFO SettingsFactory:144 - Scrollable result sets: enabled
[java] 18:34:29,731 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): enabled
[java] 18:34:29,731 INFO SettingsFactory:160 - Connection release mode: null
[java] 18:34:29,741 INFO SettingsFactory:184 - Maximum outer join fetch depth: 1
[java] 18:34:29,741 INFO SettingsFactory:187 - Default batch fetch size: 1
[java] 18:34:29,741 INFO SettingsFactory:191 - Generate SQL with comments: disabled
[java] 18:34:29,752 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
[java] 18:34:29,762 INFO SettingsFactory:334 - Query translator: org.hibernate.hql.ast.ASTQuer
yTranslatorFactory
[java] 18:34:29,942 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
[java] 18:34:29,942 INFO SettingsFactory:203 - Query language substitutions: {no='N', true=1,
yes='Y', false=0}
[java] 18:34:29,942 INFO SettingsFactory:209 - Second-level cache: enabled
[java] 18:34:29,942 INFO SettingsFactory:213 - Query cache: disabled
[java] 18:34:29,952 INFO SettingsFactory:321 - Cache provider: org.hibernate.cache.HashtableCa
cheProvider
[java] 18:34:29,992 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
[java] 18:34:29,992 INFO SettingsFactory:233 - Cache region prefix: hibernate.test
[java] 18:34:30,002 INFO SettingsFactory:237 - Structured second-level cache entries: disabled

[java] 18:34:30,052 INFO SettingsFactory:261 - Statistics: disabled
[java] 18:34:30,052 INFO SettingsFactory:265 - Deleted entity synthetic identifier rollback: d
isabled
[java] 18:34:30,062 INFO SettingsFactory:279 - Default entity-mode: pojo
[java] 18:34:30,242 INFO SessionFactoryImpl:152 - building session factory
[java] 18:34:31,704 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI
name configured
[java] 18:34:31,724 INFO Dialect:92 - Using dialect: org.hibernate.dialect.MySQLDialect
[java] 18:34:31,734 INFO Configuration:875 - processing extends queue
[java] 18:34:31,734 INFO Configuration:879 - processing collection mappings
[java] 18:34:31,744 INFO Configuration:888 - processing association property references
[java] 18:34:31,744 INFO Configuration:917 - processing foreign key constraints
[java] 18:34:31,754 INFO Configuration:875 - processing extends queue
[java] 18:34:31,754 INFO Configuration:879 - processing collection mappings
[java] 18:34:31,754 INFO Configuration:888 - processing association property references
[java] 18:34:31,764 INFO Configuration:917 - processing foreign key constraints
[java] 18:34:31,774 INFO SchemaExport:113 - Running hbm2ddl schema export
[java] 18:34:31,784 INFO SchemaExport:129 - exporting generated schema to database
[java] 18:34:31,784 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connect
ion pool (not for production use!)
[java] 18:34:31,784 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size:
1
[java] 18:34:31,784 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
[java] 18:34:31,784 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Dri
ver at URL: jdbc:mysql://localhost/progetto
[java] 18:34:31,794 INFO DriverManagerConnectionProvider:86 - connection properties: {user=roo
t, password=****}
[java] 18:34:31,824 DEBUG SchemaExport:143 - alter table AuctionItem drop foreign key FK522A9BD
61107FE9B
[java] 18:34:32,255 DEBUG SchemaExport:149 - Unsuccessful: alter table AuctionItem drop foreign
key FK522A9BD61107FE9B
[java] 18:34:32,265 DEBUG SchemaExport:150 - Table 'progetto.auctionitem' doesn't exist
[java] 18:34:32,265 DEBUG SchemaExport:143 - alter table AuctionItem drop foreign key FK522A9BD
6F65B1FAF
[java] 18:34:32,275 DEBUG SchemaExport:149 - Unsuccessful: alter table AuctionItem drop foreign
key FK522A9BD6F65B1FAF
[java] 18:34:32,275 DEBUG SchemaExport:150 - Table 'progetto.auctionitem' doesn't exist
[java] 18:34:32,275 DEBUG SchemaExport:143 - alter table Bid drop foreign key FK104DDEE6E7E98
[java] 18:34:32,285 DEBUG SchemaExport:149 - Unsuccessful: alter table Bid drop foreign key FK1
04DDEE6E7E98
[java] 18:34:32,295 DEBUG SchemaExport:150 - Table 'progetto.bid' doesn't exist
[java] 18:34:32,305 DEBUG SchemaExport:143 - alter table Bid drop foreign key FK104DDF43A3910
[java] 18:34:32,305 DEBUG SchemaExport:149 - Unsuccessful: alter table Bid drop foreign key FK1
04DDF43A3910
[java] 18:34:32,305 DEBUG SchemaExport:150 - Table 'progetto.bid' doesn't exist
[java] 18:34:32,325 DEBUG SchemaExport:143 - drop table if exists AuctionItem
[java] 18:34:32,335 DEBUG SchemaExport:143 - drop table if exists AuctionUser
[java] 18:34:32,345 DEBUG SchemaExport:143 - drop table if exists Bid
[java] 18:34:32,345 DEBUG SchemaExport:161 - create table AuctionItem (
[java] id bigint not null auto_increment,
[java] seller bigint not null,
[java] description varchar(200) not null,
[java] ends datetime,
[java] condition integer,
[java] successfulBid bigint,
[java] primary key (id),
[java] unique (seller, description)
[java] ) comment 'An item that is being auctioned.'
[java] 18:34:32,355 ERROR SchemaExport:167 - Unsuccessful: create table AuctionItem (id bigint
not null auto_increment, seller bigint not null, description varchar(200) not null, ends datetime, c
ondition integer, successfulBid bigint, primary key (id), unique (seller, description)) comment 'An
item that is being auctioned.'
[java] 18:34:32,365 ERROR SchemaExport:168 - You have an error in your SQL syntax near ''An ite
m that is being auctioned.'' at line 1
[java] 18:34:32,365 DEBUG SchemaExport:161 - create table AuctionUser (
[java] id bigint not null auto_increment,
[java] userName varchar(10) not null,
[java] `password` varchar(15) not null,
[java] email varchar(255),
[java] firstName varchar(50) not null,
[java] `initial` char(1),
[java] lastName varchar(50) not null,
[java] primary key (id),
[java] unique (userName)
[java] ) comment 'Users may bid for or sell auction items.'
[java] 18:34:32,385 ERROR SchemaExport:167 - Unsuccessful: create table AuctionUser (id bigint
not null auto_increment, userName varchar(10) not null, `password` varchar(15) not null, email varch
ar(255), firstName varchar(50) not null, `initial` char(1), lastName varchar(50) not null, primary k
ey (id), unique (userName)) comment 'Users may bid for or sell auction items.'
[java] 18:34:32,385 ERROR SchemaExport:168 - You have an error in your SQL syntax near ''Users
may bid for or sell auction items.'' at line 1
[java] 18:34:32,395 DEBUG SchemaExport:161 - create table Bid (
[java] id bigint not null auto_increment,
[java] isBuyNow char(1) not null comment 'Y if a "buy now", N if a regular bid.',
[java] item bigint not null,
[java] amount float not null,
[java] `datetime` datetime not null,
[java] bidder bigint not null,
[java] primary key (id),
[java] unique (item, amount)
[java] ) comment 'A bid or "buy now" for an item.'
[java] 18:34:32,445 ERROR SchemaExport:167 - Unsuccessful: create table Bid (id bigint not null
auto_increment, isBuyNow char(1) not null comment 'Y if a "buy now", N if a regular bid.', item big
int not null, amount float not null, `datetime` datetime not null, bidder bigint not null, primary k
ey (id), unique (item, amount)) comment 'A bid or "buy now" for an item.'
[java] 18:34:32,445 ERROR SchemaExport:168 - You have an error in your SQL syntax near 'comment
'Y if a "buy now", N if a regular bid.', item bigint not null, amount fl' at line 1
[java] 18:34:32,465 DEBUG SchemaExport:161 - alter table AuctionItem
[java] add index FK522A9BD61107FE9B (seller),
[java] add constraint FK522A9BD61107FE9B
[java] foreign key (seller)
[java] references AuctionUser (id)
[java] 18:34:32,475 ERROR SchemaExport:167 - Unsuccessful: alter table AuctionItem add index FK
522A9BD61107FE9B (seller), add constraint FK522A9BD61107FE9B foreign key (seller) references Auction
User (id)
[java] 18:34:32,475 ERROR SchemaExport:168 - Table 'progetto.auctionitem' doesn't exist
[java] 18:34:32,475 DEBUG SchemaExport:161 - alter table AuctionItem
[java] add index FK522A9BD6F65B1FAF (successfulBid),
[java] add constraint FK522A9BD6F65B1FAF
[java] foreign key (successfulBid)
[java] references Bid (id)
[java] 18:34:32,495 ERROR SchemaExport:167 - Unsuccessful: alter table AuctionItem add index FK
522A9BD6F65B1FAF (successfulBid), add constraint FK522A9BD6F65B1FAF foreign key (successfulBid) refe
rences Bid (id)
[java] 18:34:32,495 ERROR SchemaExport:168 - Table 'progetto.auctionitem' doesn't exist
[java] 18:34:32,495 DEBUG SchemaExport:161 - alter table Bid
[java] add index FK104DDEE6E7E98 (item),
[java] add constraint FK104DDEE6E7E98
[java] foreign key (item)
[java] references AuctionItem (id)
[java] 18:34:32,505 ERROR SchemaExport:167 - Unsuccessful: alter table Bid add index FK104DDEE6
E7E98 (item), add constraint FK104DDEE6E7E98 foreign key (item) references AuctionItem (id)
[java] 18:34:32,546 ERROR SchemaExport:168 - Table 'progetto.bid' doesn't exist
[java] 18:34:32,546 DEBUG SchemaExport:161 - alter table Bid
[java] add index FK104DDF43A3910 (bidder),
[java] add constraint FK104DDF43A3910
[java] foreign key (bidder)
[java] references AuctionUser (id)
[java] 18:34:32,546 ERROR SchemaExport:167 - Unsuccessful: alter table Bid add index FK104DDF43
A3910 (bidder), add constraint FK104DDF43A3910 foreign key (bidder) references AuctionUser (id)
[java] 18:34:32,576 ERROR SchemaExport:168 - Table 'progetto.bid' doesn't exist
[java] 18:34:32,576 INFO SchemaExport:173 - schema export complete
[java] 18:34:32,586 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jd
bc:mysql://localhost/progetto
[java] 18:34:32,606 INFO SessionFactoryImpl:379 - Checking 0 named queries
[java] Setting up some test data
[java] 18:34:33,186 WARN JDBCExceptionReporter:71 - SQL Error: 1146, SQLState: 42S02
[java] 18:34:33,196 ERROR JDBCExceptionReporter:72 - Table 'progetto.auctionuser' doesn't exist

[java] org.hibernate.exception.SQLGrammarException: could not insert: [org.hibernate.auction.Us
er]
[java] at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.j
ava:1777)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.j
ava:2178)
[java] at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertActio
n.java:34)
[java] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(Abstract
SaveEventListener.java:240)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventLi
stener.java:160)
[java] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSav
eEventListener.java:95)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrReque
stedId(DefaultSaveOrUpdateEventListener.java:184)
[java] at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(D
efaultSaveEventListener.java:33)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(Defaul
tSaveOrUpdateEventListener.java:173)
[java] at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveE
ventListener.java:27)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSa
veOrUpdateEventListener.java:69)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
[java] at org.hibernate.auction.Main.createTestAuctions(Main.java:293)
[java] at org.hibernate.auction.Main.main(Main.java:369)
[java] Caused by: java.sql.SQLException: Table 'progetto.auctionuser' doesn't exist
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
[java] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
[java] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
[java] at com.mysql.jdbc.Connection.execSQL(Connection.java:2376)
[java] at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
[java] at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1860)
[java] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1957)
[java] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1880)
[java] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1741)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.j
ava:1759)
[java] ... 15 more
[java] Exception in thread "main"

BUILD FAILED
C:\hibernate-3.0\build.xml:617: Java returned: 1


if hibernate "could not load definitions from resource clovertasks because It could not be found" building fails?
And why the echo "remember to place your JDBC driver in the lib directory"? I've just place my jdbc driver in lib.

I've read the read_me file in lib and I've all library required.

The system can't create the table because there is a comment in sql
Quote:
[java] 18:34:32,355 ERROR SchemaExport:167 - Unsuccessful: create table AuctionItem (id bigint
not null auto_increment, seller bigint not null, description varchar(200) not null, ends datetime, c
ondition integer, successfulBid bigint, primary key (id), unique (seller, description)) comment 'An
item that is being auctioned.'
[java] 18:34:32,365 ERROR SchemaExport:168 - You have an error in your SQL syntax near ''An ite
m that is being auctioned.'' at line 1

Help me, please! What I mess?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 12:58 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Use MySQL 4.1 or Hibernate3 CVS.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 21, 2005 3:50 am 
Newbie

Joined: Tue May 10, 2005 10:54 am
Posts: 16
Location: Italy
I'll do! :-)
Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.