db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: new functionality concerning setting member variables
Date Thu, 07 Apr 2005 21:50:25 GMT
Hi Bobby,

have a look at this

http://db.apache.org/ojb/docu/guides/advanced-technique.html#Change+PersistentField+Class

regards,
Armin

Bobby Lawrence wrote:
> I don't know if this is the correct place to ask, but...
> 
> Is it possible to tell OJB to call setter methods on the descriptor 
> classes instead of attempting to get the field, calling  
> myField.setAccessible(true), and calling the myField.set() method?  This 
> will enforce the practice of creating good JavaBeans with the proper 
> accessor methods.  It will also de-couple the names of the fields with 
> the accessor methods.
> 
> At my organization, we try to keep everything consistent by conforming 
> to a standard way of writing our Java objects.
> We use the notation:    _fieldName    for private member variables.
> I have a class with a String field called "_name" and getters/setters 
> "getName/setName".
> If I define my field descriptor as such:
> <field-descriptor name="name" .... />
> 
> OJB throws an exception because the field "name" doesn't exist.  Its 
> called "_name".
> Can I ask that OJB call the setter method instead of setting the field 
> directly?  I thought that OJB simply looked for a method
> "get< field-descriptor-name with first letter in uppercase >/set< 
> field-descriptor-name with first letter in uppercase >", but I guess it 
> doesn't.
> 
> This might have already been implemented and I just don't know it.  I am 
> using OJB 1.0.1.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Mime
View raw message