[jbosstools-issues] [JBoss JIRA] Created: (JBIDE-3956) Factory Method ... with a void return type must have an associated @Out/Databinder
Jeremy Goodell (JIRA)
jira-events at lists.jboss.org
Thu Mar 5 23:35:22 EST 2009
Factory Method ... with a void return type must have an associated @Out/Databinder
----------------------------------------------------------------------------------
Key: JBIDE-3956
URL: https://jira.jboss.org/jira/browse/JBIDE-3956
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: Seam
Affects Versions: 3.1.0
Environment: Eclipse v3.4.2 using JBoss Tools 3.1.0.Alpha1-N200903051849-H12, Seam Tools for Eclipse 3.0.0.GA-N200903051241-H11,
JBoss 4.2.3.GA, Seam 2.1.1.GA, JDK 1.5.0_09, Windows XP Media Center Edition Version 2002 Service Pack 2, HP Pavilion m7680n, Intel Core 2 Duo E6700 CPU, 2.00 GB of RAM.
Reporter: Jeremy Goodell
Google searching for the string in the Summary field results in only one set of matches. The matches all refer to JBIDE-1955, which is a case closed in March, 2008. It looked as if the problem was showing up in the Seam booking example. I DO NOT have the problem with the booking example, however I am having it on one of my session Beans (CouponCampaignListAction) but not on another (CouponListAction) both of which are included below.
I am quite new to Seam, EJB3, JPA, and Hibernate, so please forgive me if this is a non-issue. I spent about 7 hours trying to understand this issue today before submitting this report.
I was able to get rid of the error by making the factory method return a List instead of a void. But I don't understand why this would work in one class and not another. I thought the list would be outjected automatically. The fact that there was a previous bug report on the same issue made me think it might be a real problem. Thanks for any help.
CouponCampaignListAction.java (has the error):
package org.domain.rcms.session;
import static org.jboss.seam.ScopeType.SESSION;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Remove;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.domain.rcms.entity.CouponCampaign;
import org.domain.rcms.interfaces.CouponCampaignList;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.log.Log;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.annotations.datamodel.DataModelSelection;
import org.jboss.seam.annotations.security.Restrict;
@SuppressWarnings("serial")
@Stateless
@Scope(SESSION)
@Name("CouponCampaignList")
@Restrict("#{identity.loggedIn}")
public class CouponCampaignListAction implements CouponCampaignList, Serializable
{
@Logger private Log log;
@PersistenceContext
private EntityManager em;
@SuppressWarnings("unused")
@DataModel
private List<CouponCampaign> campaigns;
@DataModelSelection
private CouponCampaign currentCampaign;
@SuppressWarnings("unchecked")
@Factory
public void getCouponCampaigns()
{
log.info("Getting coupon campaigns.");
campaigns = em.createQuery("select c from CouponCampaign c where order by c.createData" )
.getResultList();
}
public CouponCampaign getCouponCampaign() {
return currentCampaign;
}
@Remove @Destroy
public void destroy() {
}
}
The error is on the getCouponCampaigns method and there is no suggestion in Eclipse for how to fix it. I have a quite similar session bean in the same package which builds just fine:
CouponListAction.java (does not have the error):
package org.domain.rcms.session;
import static org.jboss.seam.ScopeType.SESSION;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Remove;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.domain.rcms.entity.Coupon;
import org.domain.rcms.entity.CouponCampaign;
import org.domain.rcms.interfaces.CouponList;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.log.Log;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.annotations.datamodel.DataModelSelection;
import org.jboss.seam.annotations.security.Restrict;
@SuppressWarnings("serial")
@Stateless
@Scope(SESSION)
@Name("CouponList")
@Restrict("#{identity.loggedIn}")
public class CouponListAction implements CouponList, Serializable
{
@Logger private Log log;
@PersistenceContext
private EntityManager em;
@SuppressWarnings("unused")
@DataModel
private List<Coupon> coupons;
@DataModelSelection
private Coupon currentCoupon;
@In
private CouponCampaign currentCampaign;
@SuppressWarnings("unchecked")
@Factory
public void getCoupons()
{
log.info("Getting coupon campaigns.");
coupons = em.createQuery("select c from Coupon c where :currentCampaign is null or c.campaign.id = :currentCampaignId order by c.createData")
.setParameter("currentCampaign", currentCampaign)
.setParameter("currentCampaignId", currentCampaign.getId())
.getResultList();
}
public Coupon getCoupon() {
return currentCoupon;
}
@Remove @Destroy
public void destroy() {
}
}
--
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
More information about the jbosstools-issues
mailing list