[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3468) Using TransactionManagementType.BEAN sometimes gives javax.persistence.TransactionRequiredException depending on the components on the xhtml page
by Susanne Jarl (JIRA)
Using TransactionManagementType.BEAN sometimes gives javax.persistence.TransactionRequiredException depending on the components on the xhtml page
-------------------------------------------------------------------------------------------------------------------------------------------------
Key: JBSEAM-3468
URL: https://jira.jboss.org/jira/browse/JBSEAM-3468
Project: Seam
Issue Type: Bug
Components: EJB3
Affects Versions: 2.0.2.SP1
Environment: Windows XP, JBoss AS 4.2.2
Reporter: Susanne Jarl
I have a SLSB:
@Name("statService")
@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class StatServiceBean implements StatServiceLocal {
@In
EntityManager entityManager;
@Resource
SessionContext ejbContext;
public void generateStat() {
Query query = entityManager.createNativeQuery(
"INSERT INTO x"
+ "SELECT y, :currentDate, count(distinct(ip)) AS number "
+ "FROM z"
+ "WHERE datetime BETWEEN :currentDate AND :currentDatePlusOne "
+ "GROUP BY (x1) " + "ORDER BY number desc ").setParameter(
"currentDate", calCurrent.getTime()).setParameter("currentDatePlusOne",
calCurrentPlusOneDay.getTime());
// Save to database. Create manual transaction since the built in only works for 5 minutes.
UserTransaction transaction = ejbContext.getUserTransaction();
try {
transaction.begin();
query.executeUpdate();
transaction.commit();
}
catch (Exception e) {
try {
log.error("Transaction failed when updating stat. Try rolling back.", e);
transaction.rollback();
}
catch (Exception exp) {
log.error("Transaction failed roling back.", exp);
}
}
}
I have a xhtml page with components calling the generateStat method and depending of what components are on it this code works or it gives me a TransactionRequiredException.
This does not work:
<s:link action="#{statService.generateStat}" value="Update stat" />
This does not work "alone":
<h:form><h:commandButton action="#{statService.generateStat}" value="Uppdatera sidvisningsstatistik" /></h:form>
but if you add for example:
<f:subview id="subcriberView" rendered="#{userAdmin.subscriber != null}">
</f:subview>
so you have both the form with the button and this subview component that calls userAdmin which is a stateful session bean and "subscriber" is just a property, then it works! The sql insert statement is run and the database gets updated and I don't get any exceptions.
So I guess this must be a bug!
It seems like you need a call to some SFSB in the same request in order to get the manual userTransaction begin and commit to work. But in the case with <s:link> then it does not help to add the f:subview code so I don't know...
In my components.xml I have this code:
<transaction:ejb-transaction />
but if I remove it, there is no difference.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 1 month
[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3208) validateAll ignores @NotNull and @NotEmpty
by Hajo Krabbenhöft (JIRA)
[ https://jira.jboss.org/jira/browse/JBSEAM-3208?page=com.atlassian.jira.pl... ]
Hajo Krabbenhöft commented on JBSEAM-3208:
------------------------------------------
apparently my fix can cause errors like this:
Caused by javax.el.PropertyNotFoundException with message: ...: Target Unreachable, 'addressAdditions' returned null on 'User'"
to circumvent that, add a try catch around the isRequired function in src/main/org/jboss/seam/core/Validators.java
return false, if you catch a PropertyNotFoundException
> validateAll ignores @NotNull and @NotEmpty
> ------------------------------------------
>
> Key: JBSEAM-3208
> URL: https://jira.jboss.org/jira/browse/JBSEAM-3208
> Project: Seam
> Issue Type: Bug
> Components: JSF Integration
> Affects Versions: 2.0.2.SP1
> Environment: jboss-4.2.2.GA
> win xp pro
> Reporter: Hajo Krabbenhöft
> Attachments: diff.txt
>
> Time Spent: 1 day
> Remaining Estimate: 1 hour
>
> when i use s:valiadateAll and put a text field inside where the matching hibernate field has @NotEmpty set, no validation error will be raised if i submit without entering text.
> this is because JSF ignores the validators because the field is empty and not marked as required.
> therefore the ValidateAllRenderer will need to check for these validators and call evt.setRequired(true) as needed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 1 month
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3430) s:selectitems noSelectionLabel broken for java.util.Map
by Francisco Jose Peredo Noguez (JIRA)
s:selectitems noSelectionLabel broken for java.util.Map
--------------------------------------------------------
Key: JBSEAM-3430
URL: https://jira.jboss.org/jira/browse/JBSEAM-3430
Project: Seam
Issue Type: Bug
Components: JSF Controls, JSF Integration
Affects Versions: 2.0.2.SP1
Environment: On plain Tomcat 6.0.18, with JDK 1.6.u7
Reporter: Francisco Jose Peredo Noguez
This works fine, it uses a using a List<Map> as source in #{controller.sourceList}, and it should put the selected map in #{controller.mapProperty['key']} (BTW it seems it is putting the toString() fo the map in #{controller.mapProperty['key']} instead of the Map):
<h:selectOneMenu name="selectName" value="#{controller.mapProperty['key']}" >
<s:selectItems value="#{controller.sourceList}" var="item" label="#{item['label']}"/>
</h:selectOneMenu>
This crashes (the difference? I added a noSelectionLabel):
<h:selectOneMenu name="selectName" value="#{controller.mapProperty['key']}" >
<s:selectItems noSelectionLabel="Please select item" value="#{controller.sourceList}" var="item" label="#{item['label']}"/>
</h:selectOneMenu>
Stack trace:
java.lang.NullPointerException: Argument Error: Parameter targetClass is null
at com.sun.faces.application.ApplicationImpl.createConverter(ApplicationImpl.java:740)
at org.jboss.seam.jsf.SeamApplication.createConverter(SeamApplication.java:126)
at org.jboss.seam.ui.converter.ConverterChain.<init>(ConverterChain.java:88)
at org.jboss.seam.ui.component.UISelectItems.noSelectionLabel(UISelectItems.java:225)
at org.jboss.seam.ui.component.UISelectItems.getValue(UISelectItems.java:149)
at com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:323)
at com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:675)
at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:793)
at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:335)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:896)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
I think that the problem is that it can not determine the right type for the #{controller.mapProperty['key']} expression since it an entry in a java.util.Map instead of a property in a bean.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 1 month