-->
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: Mapping error
PostPosted: Fri Aug 08, 2008 12:42 pm 
Newbie

Joined: Thu Aug 07, 2008 3:41 pm
Posts: 14
Hi,

I've got some issue with my mapping. In my table Cycle I have a column called Type. This type is actually a foreign key to a DurationType.

However I get errors that it cannot find the durationType.
The package name and class name is correct.

Any ideas?

Code:
exception is org.hibernate.MappingException: Could not determine type for: nl.digirap.model.registration.DurationType, at table: CYCLUS, for columns: [org.hibernate.mapping.Column(TYPE)]


Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
   <class name="nl.digirap.model.registration.Cyclus" table="CYCLUS"
      lazy="false">
      <id name="id" column="ID" type="integer">
         <generator class="sequence">
            <param name="sequence">CYCLUS_SEQ</param>
         </generator>
      </id>
      <property name="description" column="DESCRIPTION" type="string" />
      <property name="duration" column="DURATION" type="float" />
      <property name="durationType" column="TYPE" type="nl.digirap.model.registration.DurationType" />
   </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 08, 2008 2:05 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Use <many-to-one> instead of <property> for the mapping to DurationType.
Something like:

Code:
<many-to-one
   name="durationType"
   column="TYPE"
   class="nl.digirap.model.registration.DurationType"
/>


You can find more information about <many-to-one> here:
http://www.hibernate.org/hib_docs/v3/re ... -manytoone


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 08, 2008 3:33 pm 
Newbie

Joined: Thu Aug 07, 2008 3:41 pm
Posts: 14
Thanks!


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.