-->
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: Mapping through Non-Bean methods
PostPosted: Wed Dec 19, 2007 3:06 am 
Newbie

Joined: Wed Dec 19, 2007 2:51 am
Posts: 2
Hi,

I am working on a project using hibernate 3.2.0 . I have to use a previously built class(non-bean), that i can't change, that i have to map.

This class has a public constructor (no setter methods) and a method named stringValue (no getter methods).

Now, I need to map this to a particular column(varchar) in the database. I am using jdk1.4 and i have to use .hbm.xml for mapping.

I have tried mapping it using the <component> tag, but the problem is what to write in the <property> tag, there is no property or its getter-setters in the class, only the methods.

is there any way, i can do the mapping.

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 5:31 pm 
Newbie

Joined: Wed Dec 19, 2007 5:26 pm
Posts: 1
Try to specify the attribute [ access="field" ] inside the property tag. Hibernate should directly access the property without the getter and setters.

<property name="offset" column="FILE_OFFSET" access="field">
</property>


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.