-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SchemaValidator/SchemaExport: property type required?
PostPosted: Sun Jun 11, 2006 2:45 pm 
Newbie

Joined: Sun Jun 11, 2006 2:20 pm
Posts: 1
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 3:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ant -debug should give you the full stacktrace and my guess is that it will say that it can't find property type on the Address class or (some other property/class).

You need to put the classes into the schemavalidator classpath.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.