I see the problem. Primary keys <id.../> need to have a 'generator' tag inside them. I didn't see that error message since I was using Eclipse v2.1. Once I used the command line java, I saw that error.
The fix is to change your <id ../>.. </id> tag from:
<id name="id" type="string" unsaved-value="null" >
<column name="ID" sql-type="varchar(10)" not-null="true"/>
</id>
TO include a GENERATOR tag:
<id name="id" type="string" unsaved-value="null" >
<column name="ID" sql-type="varchar(10)" not-null="true"/>
<generator class="assigned" />
</id>
I normally used "native" as the Generated type under MySQL and with the type being an int(11), or bigint (Long to hibernate) using AUTO_INCREMENT. I honestly don't know how Strings work with mysql for auto-key generation.
Anyway, with the generator set appropriately, the errors disappear:
D:\Code\HIBERN~1>java -cp mysql-connector-java-3.0.9-stable-bin.jar;commons-lang-2.0.jar;hibernate2.jar;.;dom4j.jar;comm
ons-logging-1.0.3.jar;commons-beanutils-1.6.1.jar;commons-collections-2.1.jar;cglib.jar PersonDemo
Nov 7, 2003 3:19:41 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.0.3
Nov 7, 2003 3:19:41 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hi
bernate.cglib.use_reflection_optimizer=true, 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', h
ibernate.query.imports=net.sf.hibernate.test, net.sf.hibernate.eg, hibernate.proxool.pool_alias=pool1, hibernate.connect
ion.username=X, hibernate.connection.url=jdbc:mysql://localhost:3306/test, hibernate.show_sql=false, hibernate.c
onnection.password=Y, hibernate.statement_cache.size=25, hibernate.connection.pool_size=1}
Nov 7, 2003 3:19:41 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using java.io streams to persist binary types
Nov 7, 2003 3:19:41 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Nov 7, 2003 3:19:41 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: JVM proxy support: true
Nov 7, 2003 3:19:41 PM net.sf.hibernate.cfg.Configuration addClass
INFO: Mapping resource: Person.hbm.xml
Nov 7, 2003 3:19:42 PM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: Person -> Person
Nov 7, 2003 3:19:42 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Nov 7, 2003 3:19:42 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Nov 7, 2003 3:19:42 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Nov 7, 2003 3:19:42 PM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect
Nov 7, 2003 3:19:42 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 1
Nov 7, 2003 3:19:42 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/test
Nov 7, 2003 3:19:42 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=X, password=Y}
Nov 7, 2003 3:19:42 PM net.sf.hibernate.ps.PreparedStatementCache <init>
INFO: prepared statement cache size: 25
Nov 7, 2003 3:19:42 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Use outer join fetching: true
Nov 7, 2003 3:19:42 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Use scrollable result sets: true
Nov 7, 2003 3:19:42 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JDNI name configured
Nov 7, 2003 3:19:42 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: Query language substitutions: {no='N', true=1, yes='Y', false=0}
Person = Joπo da Silva6786955904
FYI, the generators can be found at:
http://www.hibernate.org/hib_docs/refer ... pping.html
Regards,
David