I'm getting an error on parsing my hibernate.cfg.xml file:
The error occurs in Configuration.java
Code:
List errors = new ArrayList();
org.dom4j.Document doc = XMLHelper.createSAXReader("XML InputStream", errors).read( new InputSource(xmlInputStream) );
if ( errors.size()!=0 ) throw new MappingException( "invalid mapping", (Throwable) errors.get(0) );
The read produces a SAXParseException
detailMessage= "Attribute "not-null" must be declared for element type "id"."
I'm using hibernate2.1.3 with the following configuration:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory name="OldFMSF">
<!-- local connection properties -->
<property name="hibernate.connection.url">
jdbc:hsqldb://isis:11476
</property>
<property name="hibernate.connection.driver_class" />
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password" />
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for HypersonicSQL -->
<property name="dialect">
net.sf.hibernate.dialect.HSQLDialect
</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JTATransactionFactory
</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>
<mapping resource="CurrencyCode.hbm" />
</session-factory>
</hibernate-configuration>
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="net.sf.freemercator.transfer">
<class
name="CurrencyCode"
proxy="IF_CurrencyCode"
table="CURRENCY_CODE"
>
<id column="CURRENCY_CODE_ID" name="currencyCodeId" type="java.lang.Integer" not-null="true" >
<generator class="native"/>
</id>
<property
column="CURRENCY_CODE"
name="currencyCode"
not-null="false"
type="integer"
/>
<property
column="VARIANT"
length="2"
name="variant"
not-null="false"
type="string"
/>
<property
column="LANGUAGE"
length="2"
name="language"
not-null="false"
type="string"
/>
<property
column="CURRENCY_DESC"
length="50"
name="currencyDesc"
not-null="false"
type="string"
/>
</class>
</hibernate-mapping>
This code was generated by HibernateSynchronizer but it looks good to me. Any thoughts as to where I messed up? I have only the one hibernate2.jar in my classpath.