-->
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: "No persister for: java.lang.Integer" exception
PostPosted: Thu Apr 01, 2004 12:49 pm 
Newbie

Joined: Thu Apr 01, 2004 12:37 pm
Posts: 9
Hello,

I'm getting a "net.sf.hibernate.MappingException: No persister for: java.lang.Integer" exception when trying to insert a new record into any of my tables that have a FK relationship. I'm using Hibernate 2.1 w| Java and Oracle 9i.

Here's an example:

Table: DESTINATION
dest_id - integer(PK)
dest_name - varchar
desc - varchar
directions_id - integer(FK)

Table: DIRECTIONS
directions_id - integer(PK)
directions - varchar2

Destination.hbm.xml:
<class name="DestinationData" table="Destination">
<id name="destId" type="int">
<column name="dest_id"/>
<generator class="sequence">
<param name="sequence">dest_id_sq</param>
</generator>
</id>
<property name="destName">
<column name="dest_name" sql-type="varchar2"/>
</property>
<property name="description">
<column name="description" sql-type="varchar2"/>
</property>
<one-to-one name="directionsId" class="DirectionsData"/>
</class>

Directions.hbm.xml:
<class name="com.cendant.trg.getaways.model.DirectionsData" table="directions">
<id name="directionsId" type="int">
<column name="directions_id" sql-type="integer"/>
<generator class="sequence">
<param name="sequence">directions_id_sq</param>
</generator>
</id>
<property name="directions">
<column name="directions" sql-type="varchar2"/>
</property>
</class>

And finally, the test insert I'm trying to run:
dDAO = new DestinationDAO();
dData = new DestinationData();
dData.setDestName("Fort Lauderdale");
dData.setDescription("Vacation on one of Florida beautiful sunny beaches!");
dDAO.insert(dData); //simply calls hibernate's insert();

Can someone please help me!!! I don't understand why this error is being generated. I've looked through the forums, but haven't found any that identified an answer.

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 04, 2004 11:55 am 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
You have a one-to-one relationship between Destination and Direction. However, in your code for creating the Destination object you are specifying the destName and description values but there is no mention of the associated Direction. In the one-to-one relationship you could setup constrained as false or specify the Direction. I have never run into this issue so, I could be wrong.


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.