Introspection APIs change for getter and setter methods in EJBs
 Technote (FAQ)
 
Problem
After upgrading JDK™ to IBM® JDK 1.3.1 SR7 or Sun® JDK 1.3.1_09, if EJB™ has more than one getter or setter method for any given property, receive the error, "No getter method for property <property_name> of bean <bean_name>".
 
Cause
This occurs because the JDK specification changed after the release of Sun JDK 1.3.1_09 and IBM JDK 1.3.1 SR7.
 
Solution
As per the introspection specification API, property can have method that returns property type called getter method and can have method to set value for this property by taking parameter of property type called setter method.

If there is a matching pair of get<PropertyName> and set<PropertyName> methods that takes and return the same type, these methods defined a read-write property called <PropertyName>. For example, a bean that has a read-write property called text of type String, has the methods

public String getText();
public void setText(String str);

Until JDK 1.3.1 SR6, overloading of setters methods was possible. For example, if a bean had a String property text, then overloading setter methods was possible as the following shows:

private String text;

public String getText();
public void setText(Integer iText);
public void setText(String str);

In IBM SDK v1.3.1 SR7 and later, the method setText(Integer iText) in the preceding example is not considered a setter method because it takes integer object as the input parameter, while the property text is of type String.

In other words, the setter method that takes an argument that is of the same type as the property is the one that is returned.
 
Related information
JavaBeans™ 1.1 specification
Sun bug report for this problem
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Java SDK
Operating system(s): HP-UX
Software version: 4.0
Software edition:
Reference #: 1192605
IBM Group: Software Group
Modified date: Dec 8, 2004