2 Replies Latest reply on Feb 18, 2010 8:34 PM by kimda

    Occasional EntityNotFoundException error

    kimda
      Hi,

      I am working jboss seam project and initially started this by using seam gen.
      Updating COUNTY table was working fine until yesterday.

      Now, this update is working rarely. I mean it is working sometimes and it throws error message sometimes.

      this is the error message on the browser:

      Error

      Something bad happened :-(

          * Successfully updated
          * Transaction failed
          * Record not found


      and this is from the console:

      Caused by: javax.faces.el.EvaluationException: org.jboss.seam.framework.EntityNotFoundException: entity not found: org.abc.edu.model.County#261
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
           ... 48 more
      Caused by: org.jboss.seam.framework.EntityNotFoundException: entity not found: org.abc.edu.model.County#261
           at org.jboss.seam.framework.Home.handleNotFound(Home.java:201)
           at org.jboss.seam.framework.EntityHome.find(EntityHome.java:128)
           at org.jboss.seam.framework.Home.initInstance(Home.java:171)
           at org.jboss.seam.framework.Home.getInstance(Home.java:137)
           at org.jboss.seam.framework.EntityHome.getEntityName(EntityHome.java:210)
           at org.jboss.seam.framework.Home.getSimpleEntityName(Home.java:472)
           at org.jboss.seam.framework.Home.raiseAfterTransactionSuccessEvent(Home.java:460)
           at org.jboss.seam.framework.EntityHome.update(EntityHome.java:66)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)


      I have a very identical model and very same way of updating it is working just fine and hasn't given me any error.


      '
      ...
      ...

      @Name("countyHome")
      public class CountyHome extends EntityHome<County> {

           @In(create = true)
           IdentifierHome identifierHome;

           public void setCountyCountyId(Integer id) {          
                setId(id);
           }

           public Integer getCountyCountyId() {
                return (Integer) getId();
           }

           @Override
           protected County createInstance() {          
                County county = new County();
                return county;
           }

           public void wire() {
                
                getInstance();          
                Identifier identifier = identifierHome.getDefinedInstance();
                
                if (identifier != null) {               
                     getInstance().setIdentifier(identifier);
                }
           }

           public boolean isWired() {
                
                if (getInstance().getIdentifier() == null)
                     return false;
                return true;
           }

           public County getDefinedInstance() {
                
                return isIdDefined() ? getInstance() : null;
           }
           
           
      }

      ++++++++++++
        <rich:modalPanel id="khsaMp" width="850" height="150"
                  resizeable="true" moveable="true">
               ...
               ...
               ...
           
                      <h:panelGrid columns="2">
                          <h:commandButton id="save" value="Save"  action="#{countyHome.update}" />
                          <s:button value="Cancel"   onclick="#{rich:component('khsaMp')}.hide(); return false" />                     
                      </h:panelGrid>

                  </h:form>
              </rich:modalPanel>
      '