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.  [ 5 posts ] 
Author Message
 Post subject: Getting the mapping property name of a user type
PostPosted: Tue Aug 02, 2005 9:52 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
Hello all
In my user-type code I need to know the name of the property which is mapped using this user-type.
I.E. :
<property name="123" column="id" >
<type name="MyUserType"/>
</property>

In MyUserType code I need to access the string "123".
Note that this is the property name and not the SQL field name.

Is this possible ?

Thank you !

Elad


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 04, 2005 5:30 am 
Beginner
Beginner

Joined: Wed Jun 08, 2005 10:01 am
Posts: 22
Location: Italy
Hi,

you have to call the corresponding

Code:
object.get123();


bye,
nicola[/code]


Top
 Profile  
 
 Post subject: getting the property name
PostPosted: Thu Aug 04, 2005 5:40 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
Thank you for your reply !
Actually, in my user-type code, I do not know that this object will have a property name "123".

My user-type is being used by more than 1 class mapping.
However - in every class mapping it is used in a different property :

<class name="bar"
...
<property name="123" column="id" >
<type name="MyUserType"/>
</property>
...
</class>

<class name="foo"
...
<property name="321" column="other_id" >
<type name="MyUserType"/>
</property>
...
</class>

But inside my code I need to know the property name (123 / 321) .

I hope it is more clear now ...

Thank you !

Elad


Top
 Profile  
 
 Post subject: Re: getting the property name
PostPosted: Mon Aug 08, 2005 12:58 pm 
Newbie

Joined: Tue Dec 16, 2003 8:34 am
Posts: 15
Elad,

I don't think you can do it, unless you use a ParameterizedType and specify the property name for each parameter (redundant, painful).

I entered a feature request:

http://opensource.atlassian.com/project ... se/HHH-804

which was sadly rejected. The sad part is not that it was rejected, but that the feature which Gavin gave as a replacement does not look like it will solve the problem at all.

Seems like a very natural request to me. If a class is performing a custom data conversion, then it should have access at runtime to the meta-information that might be needed to properly perform the conversion.

Perhaps it would help if more people request the feature ;)

regards,

joe


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 09, 2005 3:37 am 
Beginner
Beginner

Joined: Tue May 10, 2005 4:18 am
Posts: 29
Hi jpanico
I have posted a commnet on the JIRA page. I hope Gavin will read it.


Thank you for replying ! Now I know I am not missing anything :)

Elad


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