[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-4488) Datamodel: casting exception on @Destroy

Jeff Wexler (JIRA) jira-events at lists.jboss.org
Sun Nov 29 18:04:29 EST 2009


Datamodel: casting exception on @Destroy
----------------------------------------

                 Key: JBSEAM-4488
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4488
             Project: Seam
          Issue Type: Bug
    Affects Versions: 2.1.2.GA
         Environment: Windows Server 2003, Jboss AS 5.1.0.GA, PostgreSQL 8.4
            Reporter: Jeff Wexler
            Priority: Minor


Getting the following error for a datamodel when it is used to display an h:dataTable. The dataTable is displayed fine. However, in the log, I receive:

15:04:42,312 WARN  [Component] Exception calling component @Destroy method: deliveryDeadlineOptionList
javax.ejb.EJBException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to javax.faces.model.DataModel
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
...

The bean for this is used for the following purposes: 

1. Value of an s:selectItems 

2. Value of an h:dataTable (i.e., as mentioned above)

3. Injected and used in another bean

The bean:

@Stateful
@Scope(CONVERSATION)
@Name("deliveryDeadlineOptionList")
@TransactionAttribute(REQUIRES_NEW)
public class DeliveryDeadlineOptionListAction implements DeliveryDeadlineOptionList, Serializable
{
@PersistenceContext(type=PersistenceContextType.EXTENDED)
@In(create=true)
private EntityManager entityManager;

@DataModel
private List<DeliveryDeadlineOption> deliveryDeadlineOptionsList;

@DataModelSelection
private DeliveryDeadlineOption deliveryDeadlineOption;

@Create
public void create() {getDeliveryDeadlineOptionsList();}

@Factory
public List<DeliveryDeadlineOption> getDeliveryDeadlineOptionsList(){
return (List<DeliveryDeadlineOption>) entityManager.createQuery("select c from DeliveryDeadlineOption c")
.getResultList();
}

public DeliveryDeadlineOption getDeliveryDeadlineOption(){return deliveryDeadlineOption;}

@Destroy
@Remove
public void destroy() {}
}

Relevant portions of the bean where deliveryDeadlineOptionList is injected and used:

@Stateful
@Name("quoteCalculate")
@Scope(ScopeType.CONVERSATION)
public class QuoteCalculatingAction implements QuoteCalculating
{
@PersistenceContext(type=PersistenceContextType.EXTENDED)
@In(create=true)
private EntityManager entityManager;

...

@In(value="deliveryDeadlineOptionsList", create=true)
private List<DeliveryDeadlineOption> deliveryDeadlineOptions;

@DataModel
private List<DeliveryDeadlineOption> selectedDeliveryDeadlineOptions;

...

(Standard getters and setters for above)

public void selectedDeliveryDeadlineOptionsChange(ValueChangeEvent valueChangeEvent) {
setSelectedDeliveryDeadlineOptions((List<DeliveryDeadlineOption>) valueChangeEvent.getNewValue());
...
}
...
@Destroy
@Remove
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 seam-issues mailing list