new functionality concerning setting member variables
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:_fieldNamefor 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. -- Bobby Lawrence MIS Application Developer Jefferson Lab (www.jlab.org) Email: [EMAIL PROTECTED] Office: (757) 269-5818 Pager: (757) 584-5818 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: new functionality concerning setting member variables
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. Simply change the PersistentFieldClass setting in OJB.properties to PersistentFieldIntrospectorImplNew, this will use the property accessors. Or use PersistentFieldAutoProxyImplNew, and OJB will determine for each field whether it can use the default PersistentFieldDirectAccessImplNew (which is faster) or the (slower) PersistentFieldIntrospectorImplNew. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: new functionality concerning setting member variables
Thanx! Armin Waibel wrote: 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:_fieldNamefor 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Bobby Lawrence MIS Application Developer Jefferson Lab (www.jlab.org) Email: [EMAIL PROTECTED] Office: (757) 269-5818 Pager: (757) 584-5818 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]