I used first hbm.xml
[code]
<?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.atest.hibernate.profile"
table="tb_profile"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="userid"
column="id"
type="string"
length="20"
>
<generator class="uuid.hex">
</generator>
</id>
<property
name="birthday"
type="date"
update="true"
insert="true"
column="birthday"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-profile.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
[/code]
I used SchemaExport to get a sql file,everything is OK.
but when i add a property,It was wrong.
[code]
<property
name="cardnumber"
type="String"
update="true"
insert="true"
column="cardnumber"
length="20"
/>
[/code]
the error msg is :
[java] 信息: Mapping class: com.atest.hibernate.profile -> tb_profile
[java] 2003-9-14 18:07:31 net.sf.hibernate.cfg.Configuration add
[java] 严重: Could not compile the mapping document
[java] net.sf.hibernate.MappingException: Could not interpret type: String
[java] at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:788)
[java] at net.sf.hibernate.cfg.Binder.bindValue(Binder.java:354)
[java] at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:891)
[java] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294)
[java] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
[java] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
[java] at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:155)
[java] at net.sf.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:285)
[java] 2003-9-14 18:07:31 net.sf.hibernate.cfg.Configuration addFile
I try to fix the error,but I don't know where is wrong.
who can tell me where was wrong?[/quote]
|