-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem mapping a Custom UserType Field
PostPosted: Wed Jul 15, 2009 11:52 am 
Newbie

Joined: Wed Jul 15, 2009 11:23 am
Posts: 1
Hello,

Warning: I am basically a hibernate "newbie", although I have considerable experience with O/R mapping. Hopefully I will explain my issue clearly and completely.....

I have defined a custom UserType and I am using it as a property within another object which has a corresponding mapping file. This is the first time I attempted to do this in Hibernate.

ALMOST everything is working fine. I can write the property to the database column when I persist the parent object. When a read is performed on the parent object, I can see my UserType property in the result set and the setter method for the property gets executed properly. That is, it gets executed properly when I define the property in the mapping file as one of the first <property> elements. By "properly", I mean that the parameter for the setter method contains the Object that I want to set.

The problem I am experiencing is when this <property> element is placed as the last <property> element in the mapping file for the parent object. When I do this, the value of the parameter in the setter method is always NULL. If I simply move the <property> so it is the first <property> of the parent object, I have no problems.

If you have any idea why this is happening, I would greatly appreciate your explanation. Here is the <property> element in question:

<property name="state" column="STATE" type="com.foo.hibernate.mapping.ProjectSampleStateUserType" />


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.