[forge-issues] [JBoss JIRA] (FORGE-617) Cannot access Stateful EJB from inner anonymous class
Luca Masini (JIRA)
jira-events at lists.jboss.org
Wed Aug 1 11:00:08 EDT 2012
[ https://issues.jboss.org/browse/FORGE-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709189#comment-12709189 ]
Luca Masini commented on FORGE-617:
-----------------------------------
I'm not sure, but I tried it also under TomEE with the same effect. I think that the "this" object under JBoss is also the EJB, something not true for other App Server.
I solved this way:
1) Letting the EJB class implements the Converter:
@Named
@Stateful
@ConversationScoped
public class ItemBean implements Serializable, Converter
{
...
...
2) Moving the two implementation into the top level EJB class:
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
return ItemBean.this.entityManager.find(Item.class, Long.valueOf(value));
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value)
{
if (value == null)
{
return "";
}
return String.valueOf(((Item) value).getId());
}
Of course I needed to change the reference inside the .xhtml file:
<h:selectOneMenu converter="#{itemBean}" ... >
This way the scaffolded creating page works under WLS and TomEE.
> Cannot access Stateful EJB from inner anonymous class
> -----------------------------------------------------
>
> Key: FORGE-617
> URL: https://issues.jboss.org/browse/FORGE-617
> Project: Forge
> Issue Type: Bug
> Components: Java EE APIs
> Reporter: Luca Masini
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the forge-issues
mailing list