0 Replies Latest reply on Jan 21, 2011 8:43 AM by Jaber C. Mourad

    Problem with hibernate entity and variable

    Jaber C. Mourad Novice

      Hi,

       

      I encoutered a trouble with hibernate entity stored into a process variable in jbpm 4.4...

       

      I've got every time a lazy loading error for any property of a very simple entity :

       

      @Entity
      @Table(name = "DAY_OFF_TYPE")
      public class DayOffType extends AbstractEntity {
      
            @Id
            @GeneratedValue(strategy = GenerationType.IDENTITY)
            @Column(name = "ID")
            private Long id;
            @Column(name = "KEY_LABEL", nullable = false)
            private String keyLabel;
      
            @Column(name = "PDF_TYPE", nullable = true)
            private String pdfType;
      
            @Column(name= "AVAILABILITY")
            @Enumerated(EnumType.STRING)
            private TypeOfAvailability availability;
      
            public void setAvailability(TypeOfAvailability availability) {
                  this.availability = availability;
            }
      
            public TypeOfAvailability getAvailability() {
                  return availability;
            }
      
            public Long getId() {
                  return id;
            }
      
            public void setId(Long id) {
                  this.id = id;
            }
      
            public String getKeyLabel() {
                  return keyLabel;
            }
      
            public void setKeyLabel(String keyLabel) {
                  this.keyLabel = keyLabel;
            }
      
            public String getPdfType() {
                  return pdfType;
            }
      
            public void setPdfType(String pdfType) {
                  this.pdfType = pdfType;
            }
      
      }
      

       

      I load that entity from a DAO, put it in a process variable, and trying to acces to it during an other task, and I've got an Exception when I'm trying to access to any property :

       

      [ERROR] org.hibernate.LazyInitializationException 42  - could not initialize proxy - no Session
      org.hibernate.LazyInitializationException: could not initialize proxy - no Session
              at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:167)
              at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215)
              at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
              at mypackage.data.DayOffType_$$_javassist_13.getId(DayOffType_$$_javassist_13.java)
              at mypackage.process.vacancy.VacancyProcessTest.testProcess(VacancyProcessTest.java:100)
      

       

      Any idea to solve that issue ?

       

      Regards