-->
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: UserType dependent on another field
PostPosted: Mon Oct 11, 2004 6:55 pm 
Newbie

Joined: Mon Oct 11, 2004 6:44 pm
Posts: 5
I have a UserType and inside of nullSafeGet() I need access to other fields in the containing entity. So I figured that I could cast the "owner" param that is passed in and voila - my issues are gone. Unfortunately the other fields in the "owner" containing entity have not yet been loaded and they are null. Has anyone come across this or needed to control the load order of specific fields?

Thanks,
Chris

P.S. Just for some background I have an int status that I want to be able to pull an I18N string description from - as described in the article http://www.theserverside.com/news/threa ... d_id=27171. The only difference is that I need both the int status and the string desc (ie the string desc depends on the int status, not just a string lookup key)

Hibernate version: 2.1

Mapping documents:
<id name="surrogate" column="surrogate_id" type="long">
<generator class="native"/>
</id>
<version name="version" type="int" column="version"/>
<property name="startTime" type="timestamp"/>
<property name="statusDesc" type="com.foo.CustomType"/>

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

Full stack trace of any exception that occurs:
NA

Name and version of the database you are using:
NA

The generated SQL (show_sql=true):
NA

Debug level Hibernate log excerpt:
NA


Top
 Profile  
 
 Post subject: Extend CompositeType instead of UserType
PostPosted: Fri Oct 29, 2004 4:45 pm 
Newbie

Joined: Wed Oct 20, 2004 11:21 am
Posts: 2
Make both the string and id part of the type and you should be set.


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.