-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping setter/getter methods that don't conform to POJO
PostPosted: Tue Nov 20, 2007 4:31 pm 
Beginner
Beginner

Joined: Mon Nov 19, 2007 4:40 pm
Posts: 46
Hibernate version: 3.2
Name and version of the database you are using: Oracle 10g

I have a set of objects that I would like to map to an existing database. The objects also already exist and they are not quite POJO. All of the set and get methods deviate from the POJO standard in that the first parameter of all set methods is a Context object and all get methods also contain the same Context object. This is a strict requirement for these objects and further, I must use the get/set methods (e.g. I cannot map to the fields).

For example:
Code:
public class Person
{
   public String getName(Context context) { ... }
   public void setName(Context context, String name) { ... }
}


Does anyone know if there is a pluggable way to make hibernate recognize these methods as getter/setter methods for the properties? This is a constant and predictable signature... all of my objects use a Context object.

If there is not a pluggable way... does anyone know how I might go about adding this functionality into hibernate? I have started looking into the "tuple" package and I think this is the right place to be... But, this is not the preferred course of action.

Any help/suggestions would be greatly appreciated?

Thanks in advance.

Paul


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 21, 2007 5:30 am 
Beginner
Beginner

Joined: Thu Nov 02, 2006 9:38 am
Posts: 32
Location: Belgium
http://www.hibernate.org/hib_docs/refer ... on-mapping

default-access="ClassName"

ClassName here should point to an implementation of an accessor policy (don't know the exact superclass/interface to extend) that will probably allow you to do what you want.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 21, 2007 9:54 am 
Beginner
Beginner

Joined: Mon Nov 19, 2007 4:40 pm
Posts: 46
I don't know how i didn't see this... it was right there in the documentation all along! I do believe this will solve my problem. Thank you very much!

Paul


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