[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1530) Seam-gen: @Length in char(1) property
by Luiz Augusto Ruiz (JIRA)
Seam-gen: @Length in char(1) property
-------------------------------------
Key: JBSEAM-1530
URL: http://jira.jboss.com/jira/browse/JBSEAM-1530
Project: JBoss Seam
Issue Type: Bug
Components: Tools
Affects Versions: 1.3.0.ALPHA
Reporter: Luiz Augusto Ruiz
Seam-gen put a @Length Hibernate validator in char property. When a field of a table is CHAR(1) Hibernate generates a char property and seam-gen put a @Length(size=1).
This can be fixed updating the template pojo/GetPropertyAnnotation.ftl:
<#include "Ejb3PropertyGetAnnotation.ftl"/>
<#if !property.optional>
@${pojo.importType("org.hibernate.validator.NotNull")}
</#if>
<#if property.columnSpan==1>
<#assign column = property.getColumnIterator().next()/>
<#if !c2h.isManyToOne(property) && !c2h.isTemporalValue(property) && column.length!=255 && column.length!=1>
@${pojo.importType("org.hibernate.validator.Length")}(max=${column.length?c})
</#if>
</#if>
" && column.length!=1" fix the bug.
--
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
16 years, 8 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3046) Can't @RaiseEvent from EntityHome.setInstance
by Clint Popetz (JIRA)
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
16 years, 8 months