13 Replies Latest reply on Jan 22, 2009 11:10 AM by Erdem Agaoglu

    not-null property references a null or transient value

    greg samuel Newbie

      Hi i'm sure it is a dump mistake so i'm sorry in advance


      I'm trying to persist an input text and i have the folowing stacktrace



      Caused by javax.el.ELException with message: "javax.ejb.EJBTransactionRolledbackException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.bean.workflow.Atrav.description"
      
      org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
      org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
      org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
      org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
      org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
      org.jboss.seam.navigation.Pages.callAction(Pages.java:643)
      org.jboss.seam.navigation.Pages.preRender(Pages.java:296)
      org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:560)
      org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:471)
      org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:144)
      org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:114)
      com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:619)



      this is the part of xhtml where i call the class Atrav



      <h:inputText id="description" value="#{atrav.description}" required="true">
              </h:inputText>



      and this is my generator.java



      package com.bean.workflow;
      import static org.jboss.seam.ScopeType.EVENT;
      import java.text.DateFormat;
      import java.util.Date;
      import java.util.List;
      import javax.ejb.Remove;
      import java.util.*;
      
      import java.text.SimpleDateFormat;
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.faces.FacesMessages;
      import org.jboss.seam.security.Identity;
      
      
      
      @Stateful
      @Scope(EVENT)
      @Name("generator")
      public class GeneratorAction implements Generator {
               
              
               
               
              @In(create=true)@Out
               private Atrav atrav;
              
              @In Identity identity;
               
               @PersistenceContext
                 private EntityManager em;
               
               
               
               
               
              @Override
              public void generate() {
                       
                           atrav.setetat("en attente");
                           atrav.setName(identity.getUsername());
                           System.out.print(""+atrav.getDescription());
                   em.persist(atrav);
                       System.out.println("passe");
                       
                       
              
                              
              }
      
              
              
              @Remove
                 public void destroy() {}
      }
      
      
      





      thanks for your help

        • 3. Re: not-null property references a null or transient value
          greg samuel Newbie

          Here it is ,thank you




           
          @Entity
          @Scope(EVENT)
          @Name("atrav")
          @Table(name="atrav")
          public class Atrav implements Serializable
          { 
             
               
             
             private Integer idtrav;
             private String name;
             private String description;
             private String etat;
             
             
             public Atrav(Integer idtrav,String name,String description,String etat)
             {
                  this.idtrav = idtrav;
                 this.name = name;
                 this.etat = etat;
                
             }
             
             public Atrav() {}
             
             @NotNull
             @Id @GeneratedValue
             public Integer getIdtrav()
             {
                return idtrav;
             }
             public void setIdtrav(Integer id_trav)
             {
                this.idtrav = id_trav;
             }
           
             @NotNull
             @Length(max=100)
             public String getName()
             {
                return name;
             }
             public void setName(String name)
             {
                this.name = name;
             }
             
             
             
             
             @NotNull
             @Length(min=5, max=15)
             public String getetat()
             {
                return etat;
             }
             public void setetat(String etat)
             {
                this.etat = etat;
             }
             
            
          }



          • 4. Re: not-null property references a null or transient value
            greg samuel Newbie

            Sorry i sent the wrong one



            @Entity
            @Scope(EVENT)
            @Name("atrav")
            @Table(name="atrav")
            public class Atrav implements Serializable
            { 
               
                    
               
               private Integer idtrav;
               private String name;
               private String description;
               private String etat;
               
               
               public Atrav(Integer idtrav,String name,String description,String etat)
               {
                       this.idtrav = idtrav;
                       this.description = description;
                   this.name = name;
                   this.etat = etat;
                  
               }
               
               public Atrav() {}
               
               @NotNull
               @Id @GeneratedValue
               public Integer getIdtrav()
               {
                  return idtrav;
               }
               public void setIdtrav(Integer id_trav)
               {
                  this.idtrav = id_trav;
               }
             
               @NotNull
               @Length(max=100)
               public String getName()
               {
                  return name;
               }
               public void setName(String name)
               {
                  this.name = name;
               }
               
               @NotNull
               @Length(max=100)
               public String getDescription()
               {
                  return description;
               }
               public void setDescription(String description)
               {
                  this.description = description;
               }
               
               
               
               @NotNull
               @Length(min=5, max=15)
               public String getetat()
               {
                  return etat;
               }
               public void setetat(String etat)
               {
                  this.etat = etat;
               }
               
              
            }


            • 5. Re: not-null property references a null or transient value
              greg samuel Newbie

              I'm in a hurry,could any one please help me!!

              • 6. Re: not-null property references a null or transient value
                Olivier Thierry Apprentice

                Try to put your atrav component in scope CONVERSATION instead of EVENT.

                • 7. Re: not-null property references a null or transient value
                  greg samuel Newbie

                  Thank you for your answer but it didn't work

                  • 9. Re: not-null property references a null or transient value
                    Thirupathi Neela Newbie

                    javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.domain.Portal.entity.Tasks.description1
                    javax.faces.el.EvaluationException: /TasksEdit.xhtml


                    • 10. Re: not-null property references a null or transient value
                      Thirupathi Neela Newbie
                      <code>
                      package org.domain.ajax.session;


                      Generated Jan 19, 2009 6:53:35 PM by Hibernate Tools 3.2.0.CR1


                      import org.jboss.seam.annotations.Name;
                      import java.util.Date;

                      @Name("userBean")
                      public class UserBean {
                              private String name="";
                              private java.lang.Integer screenWidth;
                              private java.lang.Integer screenHeight;
                              private String job;
                              private String address;
                              private String city;
                              private String zip;
                             
                              public UserBean() {
                                      super();
                              }
                             
                              public String getName() {
                                      return this.name;
                              }
                             
                              public void setName(String name) {
                                      this.name = name;
                              }

                              public java.lang.Integer getScreenWidth() {
                                      return screenWidth;
                              }

                              public void setScreenWidth(java.lang.Integer screenWidth) {
                                      this.screenWidth = screenWidth;
                              }

                              public java.lang.Integer getScreenHeight() {
                                      return screenHeight;
                              }

                              public void setScreenHeight(java.lang.Integer screenHeight) {
                                      this.screenHeight = screenHeight;
                              }
                             
                              public String nameItJohn() {
                                      setName("Jonh");
                                      return null;
                              }
                              public String nameItMark() {
                                      setName("Mark");
                                      return null;
                              }

                              public String getJob() {
                                      return job;
                              }

                              public void setJob(String job) {
                                      this.job = job;
                              }

                              public String getAddress() {
                                      return address;
                              }

                              public void setAddress(String address) {
                                      this.address = address;
                              }

                              public String getCity() {
                                      return city;
                              }

                              public void setCity(String city) {
                                      this.city = city;
                              }

                              public String getZip() {
                                      return zip;
                              }

                              public void setZip(String zip) {
                                      this.zip = zip;
                              }

                      }
                      </code>
                      • 11. Re: not-null property references a null or transient value
                        kanwar sangha Newbie
                        try using this -


                           @Id @GeneratedValue
                           @Column(name = "id_trav", unique = true, nullable = false)
                           public Integer getIdtrav()
                           {
                              return idtrav;
                           }
                           public void setIdtrav(Integer id_trav)
                           {
                              this.idtrav = id_trav;
                           }


                        Also, ensure that the db table as AUTO_INCREMENT for this field...
                        • 12. Re: not-null property references a null or transient value
                          kanwar sangha Newbie

                          also, define constructor as -



                          public Atrav(String name,String description,String etat)
                             {
                                   //  this.idtrav = idtrav;
                                     this.description = description;
                                 this.name = name;
                                 this.etat = etat;
                                
                             }
                             



                          • 13. Re: not-null property references a null or transient value
                            Erdem Agaoglu Newbie

                            AFAIK by defining your entity as a component in EVENT (or CONVERSATION) scope and having another component by the same name atrav outjected in your EVENT scoped GeneratorAction, you have two atrav components in place. and context search gets the EVENT scoped one thus causing problems.


                            I am not sure but you can try removing @Out in GeneratorAction.


                            BTW i dont remember exactly but i had bad times defining entities as components, so you can try getting GeneratorAction in CONVERSATION or PAGE scope and removing @Name on your @Entity.