|
Problem(Abstract) |
After upgrading your JDK to IBM® SDK 1.3.1 SR7 or Sun® JDK
1.3.1_09, if an EJB has more than one getter or setter method for any
given property, you 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 SDK 1.3.1 SR7. |
|
|
Resolving the
problem |
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 setter 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 1.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. |
|
|
|