Java bean Format:
public class Format extends HibernateBean implements Serializable {
private static final Logger log = Logger.getLogger(Format.class);
private Long id;
private boolean isQualifyFormat;
...other fields
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
**//static method, it's exposed to a HttpServlet**
public static Format getQualifyFormat() throws HibernateException {
log.debug("getQualifyFormat");
...
}
/**
* @hibernate.property column="df_isqualifyinglistformat" type="boolean"
* @return boolean
*/
public boolean isQualifyFormat() {
log.debug ("isQualifyFormat");
return isQualifyingListFormat;
}
public void setQualifyFormat(boolean qualifyFormat) {
isQualifyingListFormat = qualifyingListFormat;
}
...
}
Hibernate mapping file, Format.hbm.xml
<hibernate-mapping>
<class
name="Format"
table="dbo.mc_distribution_format"
schema="data"
>
<id
name="id"
column="df_formatid"
type="java.lang.Long"
>
<generator class="native"></generator>
</id>
<property
name="qualifyFormat"
type="boolean"
update="true"
insert="true"
column="df_isqualifyformat"
/>
In theoretically, method isQualifyFormat of bean Format should be invoked in Hibernate persistense process for bean Format. As far as I know, the getter of Boolean property can be pattern is- or get-. Method is- has the priority if both are available in the bean.
But, it works well in most cases except case: If there has any code refers to the static method, Format.getQualifyFormat, in the same jar package. The above getQualifyFormat method is invoked instead somehow even it's static and there already has the is-.
This happens when i upgraded my code to JDK 1.5. It was good in JDK 1.4. I guess this might be caused by issue of reflection improvement in JDk 1.5, does jdk/jre parses code and finds reference of static method getQualifyFormat in compiling time, then caches it as the default getter of property qualifyFormat?
Any ideas?