-->
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.  [ 4 posts ] 
Author Message
 Post subject: Who can tell me what is wrong when i export sql form hbm.xml
PostPosted: Sun Sep 14, 2003 6:12 am 
Newbie

Joined: Tue Aug 26, 2003 12:28 pm
Posts: 4
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]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 14, 2003 6:18 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Use either "string" or "java.lang.String" as the mapping type.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: I use xdoclet to create hbm.xml,I used type="string&quo
PostPosted: Sun Sep 14, 2003 6:29 am 
Newbie

Joined: Tue Aug 26, 2003 12:28 pm
Posts: 4
I use xdoclet to create hbm.xml,
the java bean code is:
[code]
/*
*


Top
 Profile  
 
 Post subject: Thanks very much,I use "java.lang.String";all OK!
PostPosted: Mon Sep 15, 2003 11:05 am 
Newbie

Joined: Tue Aug 26, 2003 12:28 pm
Posts: 4
Thanks very much,I use "java.lang.String";all OK!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.