-->
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.  [ 3 posts ] 
Author Message
 Post subject: BASIC: Why MappingException on type "text"?
PostPosted: Fri Feb 11, 2005 4:27 am 
Newbie

Joined: Fri Feb 11, 2005 4:19 am
Posts: 2
For some reason, I'm not able to use type "text" in my XML mapping. I get a "net.sf.hibernate.MappingException: Could not interpret type: text"

Seems like I'm missing something basic.

I'm using the Eclipse plug-in Hibernatesynch, and see this error when I first connect to the DB and it parses the XML files.

Please let me know your thoughts. Thanks in advance.

Best,
Andrew
Seattle, WA

Hibernate version:
2.1

Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="org.phatcast.db">

<class name="org.phatcast.db.Response" table="RESPONSE">
<id name="id" type="long" column="id">
<generator class="native"/>
</id>

<many-to-one
name="member"
column="MEMBER_ID"
class="org.phatcast.db.Member"
not-null="true"
/>

<many-to-one
name="challenge"
column="CHALLENGE_ID"
class="org.phatcast.db.Challenge"
not-null="true"
/>

<property name="datePosted" column="DATE_POSTED" not-null="true" type="timestamp" />
<property name="title" column="TITLE" not-null="true" type="string" />
<property name="teaserText" column="TEASER_DESC" not-null="true" type="string" />
<property name="fullText" column="FULL_DESC" not-null="true" type="text" />
<property name="license" column="LICENSE" not-null="true" type="string" />
<property name="isPublic" column="IS_PUBLIC" not-null="true" type="yes_no" />

<set name="payments" >
<key column="RESPONSE_ID" />
<one-to-many class="org.phatcast.db.Payment" />
</set>

</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/commons-dbcp-1.2.1.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/commons-logging-1.0.4.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/commons-pool-1.2.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/hibernate2.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/log4j-1.2.8.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/xalan-2.4.0.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/xerces-2.4.0.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/xml-apis.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/commons-logging.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/jstl.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/junit.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/log4j-1.2.9.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/spring.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/standard.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/servlet.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/j2ee.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/cglib-full-2.0.2.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/db-ojb-1.0.1.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/dom4j.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/jta.jar
Adding Project Depedents C:/Workspace/Phatcast/war/WEB-INF/lib/mysql-connector-java-3.1.6-bin.jar
Adding Project Classpath file:/C:/Workspace/Phatcast/bin/
Adding Mapping - C:/Workspace/Phatcast/war/WEB-INF/mappings/Withdrawl.hbm.xml
Adding Mapping - C:/Workspace/Phatcast/war/WEB-INF/mappings/Response.hbm.xml
net.sf.hibernate.MappingException: Could not interpret type: text
at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:788)
at net.sf.hibernate.cfg.Binder.bindValue(Binder.java:354)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:891)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:155)
at net.sf.hibernator.HibernateConnection.createConnection(HibernateConnection.java:168)
at net.sf.hibernator.views.ConnectionView$8.run(ConnectionView.java:199)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)
rethrown as net.sf.hibernate.MappingException: Could not interpret type: text
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:159)
at net.sf.hibernator.HibernateConnection.createConnection(HibernateConnection.java:168)
at net.sf.hibernator.views.ConnectionView$8.run(ConnectionView.java:199)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)
Caused by: net.sf.hibernate.MappingException: Could not interpret type: text
at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:788)
at net.sf.hibernate.cfg.Binder.bindValue(Binder.java:354)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:891)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:294)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:155)
... 3 more

Name and version of the database you are using:
MySQL 4.0.21

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 11, 2005 3:35 pm 
Regular
Regular

Joined: Wed Jan 19, 2005 4:52 pm
Posts: 61
Location: Kansas City, USA
I am using the same DB, i have all of my field types maped as Java types ie java.lang.String. try that it should work.


Top
 Profile  
 
 Post subject: Worked around it...
PostPosted: Fri Feb 11, 2005 3:40 pm 
Newbie

Joined: Fri Feb 11, 2005 4:19 am
Posts: 2
Thanks for the reply.

I ended up changing it to type "string," and setting a long length, which automatically got it translated to a TEXT type. Weird to see it not work under "text," because it's mentioned as a legit field type in the documentation and in "Hibernate in Action"

Thanks for everyone's time.

Best,
Andrew


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