Hi All,
I'm having silly problem with SchemaValidator (and SchemaExport originally).
It seems that if a property does not have type-attribute, then it is not accepted. However, documentation says that type is optional attribute!
So first of all, am I missing something or is validator out of date or something? Is there any sort of fix to this for validator and especially SchemaExport?
Secondly, i'm using xdoclet 2 to generate these mappings, is there a way to automatically include type-attribute as it works in xdoclet 1? This would be a nice workaround.
this works
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="example.Address" >
<id name="id" type="long" unsaved-value="0">
<generator class="native">
</generator>
</id>
<property name="postalcode" update="true" insert="true" column="postalcode" type="java.lang.String"/>
</class>
</hibernate-mapping>
this does not
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="example.Address" >
<id name="id" type="long" unsaved-value="0">
<generator class="native">
</generator>
</id>
<property name="postalcode" update="true" insert="true" column="postalcode" />
</class>
</hibernate-mapping>
Hibernate version: 3.1.3
Ant task:
<target name="schemavalidate">
<taskdef name="schemavalidator"
classname="org.hibernate.tool.hbm2ddl.SchemaValidatorTask"
classpathref="hibtask.class.path"/>
<schemavalidator
properties="hibernate-export.properties">
<fileset dir="${basedir}/hibernate_mappings/">
<include name="**/Address.hbm.xml"/>
</fileset>
</schemavalidator>
</target>
Ant build output:
Buildfile: build.xml
schemavalidate:
[schemavalidator] Jun 11, 2006 9:25:53 PM org.hibernate.cfg.Environment <clinit>
[schemavalidator] INFO: Hibernate 3.1.3
[schemavalidator] Jun 11, 2006 9:25:53 PM org.hibernate.cfg.Environment <clinit>
[schemavalidator] INFO: hibernate.properties not found
[schemavalidator] Jun 11, 2006 9:25:53 PM org.hibernate.cfg.Environment <clinit>
[schemavalidator] INFO: using CGLIB reflection optimizer
[schemavalidator] Jun 11, 2006 9:25:53 PM org.hibernate.cfg.Environment <clinit>
[schemavalidator] INFO: using JDK 1.4 java.sql.Timestamp handling
[schemavalidator] Jun 11, 2006 9:25:53 PM org.hibernate.cfg.Configuration addFile
[schemavalidator] INFO: Reading mappings from file: hibernate_mappings/example/Address.hbm.xml
[schemavalidator] Jun 11, 2006 9:25:54 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[schemavalidator] INFO: Mapping class: example.Address -> Address
BUILD FAILED
build.xml:249: Schema text failed: Could not read mapping document from file: hibernate_mappings/example/Address.hbm.xml
Total time: 2 seconds
|