Hay, I 'm new with Hibernate, somehow I feel it's hard to pick it up. One of frustration I had is with the tools, please help.
my User.hbm.xml
------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.eem.dao.User" table="user" dynamic-update="false" dynamic-insert="false">
<id column="userid" name="userid" type="java.lang.Long">
<generator class="native" />
</id>
<property name="loginName" column="loginname" length="15" type="java.lang.String" not-null="true" unique="true"/>
</class>
</hibernate-mapping>
--------------------------------------------
Here is result of executing SchemaExport:
[INFO] Environment - -Hibernate 2.0.3
[INFO] Environment - -loaded properties from resource hibernate.properties: {hibernate.connection.username=root, hiberna
te.connection.password=eem, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.My
SQLDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/eem, hibernate.connection.driver_class=org.gjt.mm.mysql
.Driver}
[INFO] Environment - -using CGLIB reflection optimizer
[INFO] Environment - -JVM proxy support: true
[INFO] Configuration - -Mapping file: f:\workspace\eemproject\src\com\eem\dao\User.hbm.xml
[INFO] Binder - -Mapping class: com.eem.dao.User -> user
Exception in thread "main" java.lang.ExceptionInInitializerError: java.lang.NullPointerException
at java.util.HashMap.put(Unknown Source)
at net.sf.hibernate.type.TypeFactory.<clinit>(TypeFactory.java:50)
at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:787)
at net.sf.hibernate.cfg.Binder.bindValue(Binder.java:354)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:224)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:155)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:285)
Here is the problem with hbm2java. I do have (checked again) org/xml/sax/SAXNotRecognizedException in xml-apis.jar, but.... anybody has similar problem before?
F:\hibernate2.0.3\tools\bin>hbm2java.bat
F:\hibernate2.0.3\tools\bin>rem -------------------------------------------------------------------
F:\hibernate2.0.3\tools\bin>rem Execute hbm2java tool
F:\hibernate2.0.3\tools\bin>rem -------------------------------------------------------------------
F:\hibernate2.0.3\tools\bin>set JDBC_DRIVER=F:\jboss-3.2.2RC2\server\default\lib\mysql-connector-java-3.0.8-stable-bin.j
ar
F:\hibernate2.0.3\tools\bin>set HIBERNATE_HOME=f:\hibernate2.0.3
F:\hibernate2.0.3\tools\bin>set CORELIB=f:\hibernate2.0.3\lib
F:\hibernate2.0.3\tools\bin>set LIB=f:\HIBERNATE_HOME\tools\lib
F:\hibernate2.0.3\tools\bin>set PROPS=f:\hibernate2.0.3\src
F:\hibernate2.0.3\tools\bin>set CP=f:\hibernate2.0.3\lib\xml-apis.jar;F:\jboss-3.2.2RC2\server\default\lib\mysql-connect
or-java-3.0.8-stable-bin.jar;f:\hibernate2.0.3\src;f:\hibernate2.0.3\hibernate2.jar;f:\hibernate2.0.3\lib\commons-loggin
g.jar;f:\hibernate2.0.3\lib\commons-collections.jar;f:\hibernate2.0.3\lib\commons-lang.jar;f:\hibernate2.0.3\lib\cglib.j
ar;f:\hibernate2.0.3\lib\dom4j.jar;f:\hibernate2.0.3\lib\odmg.jar;f:\hibernate2.0.3\lib\xerces.jar;f:\hibernate2.0.3\lib
\xalan.jar;f:\HIBERNATE_HOME\tools\lib\jdom.jar;f:\hibernate2.0.3\tools\hibernate-tools.jar
F:\hibernate2.0.3\tools\bin>java -cp f:\hibernate2.0.3\lib\xml-apis.jar;F:\jboss-3.2.2RC2\server\default\lib\mysql-conne
ctor-java-3.0.8-stable-bin.jar;f:\hibernate2.0.3\src;f:\hibernate2.0.3\hibernate2.jar;f:\hibernate2.0.3\lib\commons-logg
ing.jar;f:\hibernate2.0.3\lib\commons-collections.jar;f:\hibernate2.0.3\lib\commons-lang.jar;f:\hibernate2.0.3\lib\cglib
.jar;f:\hibernate2.0.3\lib\dom4j.jar;f:\hibernate2.0.3\lib\odmg.jar;f:\hibernate2.0.3\lib\xerces.jar;f:\hibernate2.0.3\l
ib\xalan.jar;f:\HIBERNATE_HOME\tools\lib\jdom.jar;f:\hibernate2.0.3\tools\hibernate-tools.jar net.sf.hibernate.tool.hbm2
java.CodeGenerator
Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/SAXNotRecognizedException
at net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:38)
|