Can't @RaiseEvent from EntityHome.setInstance
---------------------------------------------
Key: JBSEAM-3046
URL:
http://jira.jboss.com/jira/browse/JBSEAM-3046
Project: Seam
Issue Type: Bug
Affects Versions: 2.0.2.GA
Reporter: Clint Popetz
If one overrides setInstance() in an entityHome subclass in order to raise an event when
the instance changes:
@Name("dateRangeHome")
public class DateRangeHome extends EntityHome<DateRange> {
@RaiseEvent("edu.academyart.monitor.action.dateRangeChanged")
public void setInstance(DateRange instance) {
super.setInstance(instance);
}
}
and then does this in the view:
<h:selectOneMenu value="#{dateRangeHome.instance}">
<s:selectItems value="#{dateRangeList.resultList}"
var="dateRange" label="#{dateRange.title}">
<s:convertEntity/>
<a:support event="onchange"
action="refresh" ajaxSingle="true" reRender="graph"/>
</h:selectOneMenu>
the event will never be raised. This is because javac creates a synthetic
setInstance(Object) in addition to the actual setInstance(Date), because the overridden
method is a generic. When EL looks for setInstance() it finds the Object version first,
which is not annotated, so the event interceptor does nothing, and the delegated call is
of course not intercepted. Yuck!
This might be considered a bug in javac, or a deficiency in the reflection API, or a bug
in the BeanELResolver, depending on who you talk to.
Here's a discussion:
http://sensualjava.blogspot.com/2007/11/walls-and-bridges.html
I can't think of an easy workaround in seam itself.
Since the framework classes make use of templates, and since seam-gen users are inevitably
going to try overriding methods in those classes and annotated them, it would be worth
having documentation to clarify this behavior.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira