Hibernate version: 3.1
Name and version of the database you are using: MySQL 4.1
Java version: 1.5
It appears that the "Getting Started" web page (
http://www.hibernate.org/152.html) needs some repair. It does not work.
I have downloaded Hibernate 3.1 (on Win XP SP2) and extracted the archive.
I haved placed the MySQL JDBC driver JAR in the Hibernate lib directory.
I have edited etc/hibernate.properties and set it up for MySQL.
I have Ant 1.6.2 installed.
Now the problems begin. It's time to build the examples.
The web page says: copy
antlr.jar and
junit.jar to ANT_HOME/lib, but there are no such files in hibernate/lib or elsewhere.
(There
are files named
ant-antlr.jar and
ant-junit.jar in ANT_HOME/lib, and there
are files named
ant-antlr-1.6.5.jar and
ant-junit-1.6.5 in hibernate/lib).
Big confusion! But it
appears that there are .jar files for antlr and juint present. So I just try to build the examples with
ant eg. No luck:
> ant eg
C:\Program Files\hibernate-3.1\build.xml:116: taskdef A class needed by class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask cannot be found: junit/fram ework/Test
Adding Ant's
lib to the classpath gives the same result.
If I instead add Hibernate's
lib to the classpath:
> ant eg
Invalid implementation version between Ant core and Ant optional tasks.
core : 1.6.5
optional: 1.6.2
And if I add
both (first Ant's and then Hibernate's
lib), I get the following failure (see below).
Help....
>ant eg
Buildfile: build.xml
[taskdef] Could not load definitions from resource checkstyletask.properties.
It could not be found.
[taskdef] Could not load definitions from resource clovertasks. It could not b
e found.
eg:
[echo] remember to place your JDBC driver in the lib directory
[java] 15:32:42,859 INFO Environment:479 - Hibernate 3.1.2
[java] 15:32:42,875 INFO Environment:494 - loaded properties from resource
hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver,
hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=o
rg.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernat
e.dialect=org.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_bin
ary=true, hibernate.format_sql=true, hibernate.query.substitutions=yes 'Y', no '
N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibe
rnate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:mysql://
localhost, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_da
ta=true, hibernate.connection.pool_size=1}
[java] 15:32:42,875 INFO Environment:524 - using java.io streams to persis
t binary types
[java] 15:32:42,875 INFO Environment:525 - using CGLIB reflection optimize
r
[java] 15:32:42,890 INFO Environment:555 - using JDK 1.4 java.sql.Timestam
p handling
[java] 15:32:42,968 INFO Configuration:497 - Reading mappings from resourc
e: org/hibernate/auction/AuctionItem.hbm.xml
[java] 15:32:43,437 INFO HbmBinder:309 - Mapping class: org.hibernate.auct
ion.AuctionItem -> AuctionItem
[java] 15:32:43,546 INFO Configuration:497 - Reading mappings from resourc
e: org/hibernate/auction/Bid.hbm.xml
[java] 15:32:43,609 INFO HbmBinder:309 - Mapping class: org.hibernate.auct
ion.Bid -> Bid
[java] 15:32:43,656 INFO HbmBinder:824 - Mapping subclass: org.hibernate.a
uction.BuyNow -> Bid
[java] 15:32:43,656 INFO Configuration:497 - Reading mappings from resourc
e: org/hibernate/auction/User.hbm.xml
[java] 15:32:43,718 INFO HbmBinder:309 - Mapping class: org.hibernate.auct
ion.User -> AuctionUser
[java] 15:32:43,718 INFO HbmBinder:2349 - Mapping collection: org.hibernat
e.auction.AuctionItem.bids -> Bid
[java] 15:32:43,718 INFO HbmBinder:2349 - Mapping collection: org.hibernat
e.auction.User.bids -> Bid
[java] 15:32:43,718 INFO HbmBinder:2349 - Mapping collection: org.hibernat
e.auction.User.auctions -> AuctionItem
[java] 15:32:43,906 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[java] 15:32:43,906 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 1
[java] 15:32:43,906 INFO DriverManagerConnectionProvider:45 - autocommit m
ode: false
[java] 15:32:43,906 INFO DriverManagerConnectionProvider:80 - using driver
: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost
[java] 15:32:43,906 INFO DriverManagerConnectionProvider:86 - connection p
roperties: {user=root, password=****}
[java] 15:32:43,921 WARN SettingsFactory:103 - Could not obtain connection
metadata
[java] java.sql.SQLException: No suitable driver
[java] at java.sql.DriverManager.getConnection(DriverManager.java:545)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getC
onnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFacto
ry.java:72)
[java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.j
ava:1881)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
tion.java:1174)
[java] at org.hibernate.auction.Main.main(Main.java:368)
[java] 15:32:43,937 INFO Dialect:103 - Using dialect: org.hibernate.dialec
t.MySQLDialect
[java] 15:32:43,953 INFO TransactionFactoryFactory:31 - Using default tran
saction strategy (direct JDBC transactions)
[java] 15:32:43,953 INFO TransactionManagerLookupFactory:33 - No Transacti
onManagerLookup configured (in JTA environment, use of read-write or transaction
al second-level cache is not recommended)
[java] 15:32:43,953 INFO SettingsFactory:125 - Automatic flush during befo
reCompletion(): disabled
[java] 15:32:43,953 INFO SettingsFactory:129 - Automatic session close at
end of transaction: disabled
[java] 15:32:43,953 INFO SettingsFactory:144 - Scrollable result sets: dis
abled
[java] 15:32:43,968 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
isabled
[java] 15:32:43,968 INFO SettingsFactory:160 - Connection release mode: au
to
[java] 15:32:43,968 INFO SettingsFactory:184 - Maximum outer join fetch de
pth: 1
[java] 15:32:43,968 INFO SettingsFactory:187 - Default batch fetch size: 1
[java] 15:32:43,968 INFO SettingsFactory:191 - Generate SQL with comments:
disabled
[java] 15:32:43,968 INFO SettingsFactory:195 - Order SQL updates by primar
y key: disabled
[java] 15:32:43,968 INFO SettingsFactory:338 - Query translator: org.hiber
nate.hql.ast.ASTQueryTranslatorFactory
[java] 15:32:43,968 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTran
slatorFactory
[java] 15:32:43,968 INFO SettingsFactory:203 - Query language substitution
s: {no='N', yes='Y'}
[java] 15:32:43,968 INFO SettingsFactory:209 - Second-level cache: enabled
[java] 15:32:43,968 INFO SettingsFactory:213 - Query cache: disabled
[java] 15:32:43,968 INFO SettingsFactory:325 - Cache provider: org.hiberna
te.cache.HashtableCacheProvider
[java] 15:32:43,968 INFO SettingsFactory:228 - Optimize cache for minimal
puts: disabled
[java] 15:32:43,968 INFO SettingsFactory:233 - Cache region prefix: hibern
ate.test
[java] 15:32:43,984 INFO SettingsFactory:237 - Structured second-level cac
he entries: disabled
[java] 15:32:43,984 INFO SettingsFactory:264 - Statistics: disabled
[java] 15:32:43,984 INFO SettingsFactory:268 - Deleted entity synthetic id
entifier rollback: disabled
[java] 15:32:43,984 INFO SettingsFactory:283 - Default entity-mode: pojo
[java] 15:32:44,031 INFO SessionFactoryImpl:153 - building session factory
[java] 15:32:44,359 INFO SessionFactoryObjectFactory:82 - Not binding fact
ory to JNDI, no JNDI name configured
[java] 15:32:44,359 INFO SchemaExport:155 - Running hbm2ddl schema export
[java] 15:32:44,375 DEBUG SchemaExport:173 - import file not found: /import
.sql
[java] 15:32:44,375 INFO SchemaExport:182 - exporting generated schema to
database
[java] 15:32:44,375 ERROR SchemaExport:208 - schema export unsuccessful
[java] java.sql.SQLException: No suitable driver
[java] at java.sql.DriverManager.getConnection(DriverManager.java:545)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getC
onnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.tool.hbm2ddl.SchemaExport$SuppliedConnectionPro
viderConnectionHelper.getConnection(SchemaExport.java:432)
[java] at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.
java:183)
[java] at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.j
ava:135)
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
pl.java:294)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
tion.java:1176)
[java] at org.hibernate.auction.Main.main(Main.java:368)
[java] Setting up some test data
[java] 15:32:44,437 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState
: 08001
[java] 15:32:44,437 ERROR JDBCExceptionReporter:72 - No suitable driver
[java] Exception in thread "main" org.hibernate.exception.JDBCConnectionExc
eption: Cannot open connection
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateCon
verter.java:72)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
tionHelper.java:43)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
tionHelper.java:29)
[java] at org.hibernate.jdbc.ConnectionManager.openConnection(Connectio
nManager.java:363)
[java] at org.hibernate.jdbc.ConnectionManager.getConnection(Connection
Manager.java:122)
[java] at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:12
5)
[java] at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransacti
on.java:57)
[java] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.j
ava:1309)
[java] at org.hibernate.auction.Main.createTestAuctions(Main.java:285)
[java] at org.hibernate.auction.Main.main(Main.java:370)
[java] Caused by: java.sql.SQLException: No suitable driver
[java] at java.sql.DriverManager.getConnection(DriverManager.java:545)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getC
onnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.jdbc.ConnectionManager.openConnection(Connectio
nManager.java:360)
[java] ... 6 more
BUILD FAILED
C:\Program Files\hibernate-3.1\build.xml:707: Java returned: 1
Total time: 3 seconds
>