0 Replies Latest reply on Feb 22, 2010 6:21 PM by sai burgula

    Unable to establish name of entity class

    sai burgula Novice
      Hi

      I have a Object CourseOffering, which has a list of TaAssignments associated with it.  It is a one to Many relationship between CourseOffering and TaAssignment.

      Now the TaAssignment object has a field workTypeCode which is of type StuWorkTypes entity.

      This issue is that, I am able to display the TaAssignment list related to a CourseOffering object.  But when I click on any row of TaAssignment. I get the following error:

      Unable to establish name of entity class edu.cmu.heinz.hcis.entity.StuWorkTypes_$$_javassist_19

      I first add a new TaAssignment object for a selected CourseOffering.  Then I go back to my initial screen and traverse to the list of TaASsignment objects associated with the selected CourseOffering.

      Now the TaAssignment dataTable is clickable on each row.  When I click on any row I get the above error.

      Let me paste some code for reference.

      First the entity class(StuWorkTypes)
      --------------------------------------------------------------------------------------

      package edu.cmu.heinz.hcis.entity;

      // Generated Feb 19, 2010 2:46:13 PM by Hibernate Tools 3.2.4.GA

      import java.util.Date;
      import java.util.HashSet;
      import java.util.Set;

      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.FetchType;
      import javax.persistence.Id;
      import javax.persistence.OneToMany;
      import javax.persistence.Table;
      import javax.persistence.Temporal;
      import javax.persistence.TemporalType;
      import javax.persistence.UniqueConstraint;
      import org.hibernate.validator.Length;
      import org.hibernate.validator.NotNull;

      /**
      * StuWorkTypes generated by hbm2java
      */
      @Entity
      @Table(name = "STU_WORK_TYPES", schema = "KARYN", uniqueConstraints = @UniqueConstraint(columnNames = "DESCRIPTION"))
      public class StuWorkTypes implements java.io.Serializable {

           private char workTypeCode;
           private String description;
           private String payUnit;
           private String enteredBy;
           private Date dateEntered;
           private String updatedBy;
           private Date dateUpdated;
           private Set<TaAssignment> taAssignments = new HashSet<TaAssignment>(0);

           public StuWorkTypes() {
           }

           public StuWorkTypes(char workTypeCode, String description) {
                this.workTypeCode = workTypeCode;
                this.description = description;
           }

           public StuWorkTypes(char workTypeCode, String description, String payUnit,
                     String enteredBy, Date dateEntered, String updatedBy,
                     Date dateUpdated, Set<TaAssignment> taAssignments) {
                this.workTypeCode = workTypeCode;
                this.description = description;
                this.payUnit = payUnit;
                this.enteredBy = enteredBy;
                this.dateEntered = dateEntered;
                this.updatedBy = updatedBy;
                this.dateUpdated = dateUpdated;
                this.taAssignments = taAssignments;
           }

           @Id
           @Column(name = "WORK_TYPE_CODE", unique = true, nullable = false, length = 1)
           @NotNull
           public char getWorkTypeCode() {
                return this.workTypeCode;
           }

           public void setWorkTypeCode(char workTypeCode) {
                this.workTypeCode = workTypeCode;
           }

           @Column(name = "DESCRIPTION", unique = true, nullable = false, length = 30)
           @NotNull
           @Length(max = 30)
           public String getDescription() {
                return this.description;
           }

           public void setDescription(String description) {
                this.description = description;
           }

           @Column(name = "PAY_UNIT", length = 11)
           @Length(max = 11)
           public String getPayUnit() {
                return this.payUnit;
           }

           public void setPayUnit(String payUnit) {
                this.payUnit = payUnit;
           }

           @Column(name = "ENTERED_BY", length = 40)
           @Length(max = 40)
           public String getEnteredBy() {
                return this.enteredBy;
           }

           public void setEnteredBy(String enteredBy) {
                this.enteredBy = enteredBy;
           }

           @Temporal(TemporalType.DATE)
           @Column(name = "DATE_ENTERED", length = 7)
           public Date getDateEntered() {
                return this.dateEntered;
           }

           public void setDateEntered(Date dateEntered) {
                this.dateEntered = dateEntered;
           }

           @Column(name = "UPDATED_BY", length = 40)
           @Length(max = 40)
           public String getUpdatedBy() {
                return this.updatedBy;
           }

           public void setUpdatedBy(String updatedBy) {
                this.updatedBy = updatedBy;
           }

           @Temporal(TemporalType.DATE)
           @Column(name = "DATE_UPDATED", length = 7)
           public Date getDateUpdated() {
                return this.dateUpdated;
           }

           public void setDateUpdated(Date dateUpdated) {
                this.dateUpdated = dateUpdated;
           }
           
           @OneToMany(fetch = FetchType.LAZY, mappedBy = "workTypeCode")
           public Set<TaAssignment> getTaAssignments() {
                return taAssignments;
           }

           public void setTaAssignments(Set<TaAssignment> taAssignments) {
                this.taAssignments = taAssignments;
           }

      }
      ------------------------------------------------------------------------------------

      Next TaAssigment Entity

      -------------------------------------------------------------------------------------

      package edu.cmu.heinz.hcis.entity;

      // Generated Oct 29, 2009 12:18:21 PM by Hibernate Tools 3.2.4.GA

      import java.math.BigDecimal;
      import java.util.Date;
      import javax.persistence.AttributeOverride;
      import javax.persistence.AttributeOverrides;
      import javax.persistence.Column;
      import javax.persistence.EmbeddedId;
      import javax.persistence.Entity;
      import javax.persistence.FetchType;
      import javax.persistence.JoinColumn;
      import javax.persistence.ManyToOne;
      import javax.persistence.Table;
      import javax.persistence.Temporal;
      import javax.persistence.TemporalType;
      import org.hibernate.validator.Length;
      import org.hibernate.validator.NotNull;

      /**
      * TaAssignment generated by hbm2java
      */
      @Entity
      @Table(name = "TA_ASSIGNMENT", schema = "KARYN")
      public class TaAssignment implements java.io.Serializable {

           private static final long serialVersionUID = 1L;
           
           private TaAssignmentId id;
           private StuWorkTypes workTypeCode;
           private BigDecimal payRate;
           private WorkPayUnit payUnit;
           private Integer facId;
           private String taNotes;
           private String supervisor;
           private String notesStatus;
           private String enteredBy;
           private Date dateEntered;
           private String updatedBy;
           private Date dateUpdated;
           private BigDecimal rating;
           private Short noRaters;

           public TaAssignment() {
           }

           public TaAssignment(TaAssignmentId id) {
                this.id = id;
           }

           public TaAssignment(TaAssignmentId id, StuWorkTypes workTypeCode,
                     BigDecimal payRate, WorkPayUnit payUnit, Integer facId, String taNotes,
                     String supervisor, String notesStatus, String enteredBy,
                     Date dateEntered, String updatedBy, Date dateUpdated,
                     BigDecimal rating, Short noRaters) {
                this.id = id;
                this.workTypeCode = workTypeCode;
                this.payRate = payRate;
                this.payUnit = payUnit;
                this.facId = facId;
                this.taNotes = taNotes;
                this.supervisor = supervisor;
                this.notesStatus = notesStatus;
                this.enteredBy = enteredBy;
                this.dateEntered = dateEntered;
                this.updatedBy = updatedBy;
                this.dateUpdated = dateUpdated;
                this.rating = rating;
                this.noRaters = noRaters;
           }

           @EmbeddedId
           @AttributeOverrides( {
                     @AttributeOverride(name = "taId", column = @Column(name = "TA_ID", nullable = false, precision = 22, scale = 0)),
                     @AttributeOverride(name = "semester", column = @Column(name = "SEMESTER", nullable = false, length = 3)),
                     @AttributeOverride(name = "courseNo", column = @Column(name = "COURSE_NO", nullable = false, length = 8)),
                     @AttributeOverride(name = "section", column = @Column(name = "SECTION", nullable = false, length = 2)) })
           @NotNull
           public TaAssignmentId getId() {
                return this.id;
           }

           public void setId(TaAssignmentId id) {
                this.id = id;
           }

           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "WORK_TYPE_CODE")
           public StuWorkTypes getWorkTypeCode() {
                return this.workTypeCode;
           }

           public void setWorkTypeCode(StuWorkTypes workTypeCode) {
                this.workTypeCode = workTypeCode;
           }

           @Column(name = "PAY_RATE", precision = 6)
           public BigDecimal getPayRate() {
                return this.payRate;
           }

           public void setPayRate(BigDecimal payRate) {
                this.payRate = payRate;
           }

           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "PAY_UNIT")
           public WorkPayUnit getPayUnit() {
                return this.payUnit;
           }

           public void setPayUnit(WorkPayUnit payUnit) {
                this.payUnit = payUnit;
           }

           @Column(name = "FAC_ID", precision = 6, scale = 0)
           public Integer getFacId() {
                return this.facId;
           }

           public void setFacId(Integer facId) {
                this.facId = facId;
           }

           @Column(name = "TA_NOTES", length = 300)
           @Length(max = 300)
           public String getTaNotes() {
                return this.taNotes;
           }

           public void setTaNotes(String taNotes) {
                this.taNotes = taNotes;
           }

           @Column(name = "SUPERVISOR", length = 30)
           @Length(max = 30)
           public String getSupervisor() {
                return this.supervisor;
           }

           public void setSupervisor(String supervisor) {
                this.supervisor = supervisor;
           }

           @Column(name = "NOTES_STATUS", length = 1)
           @Length(max = 1)
           public String getNotesStatus() {
                return this.notesStatus;
           }

           public void setNotesStatus(String notesStatus) {
                this.notesStatus = notesStatus;
           }

           @Column(name = "ENTERED_BY", length = 20)
           @Length(max = 20)
           public String getEnteredBy() {
                return this.enteredBy;
           }

           public void setEnteredBy(String enteredBy) {
                this.enteredBy = enteredBy;
           }

           @Temporal(TemporalType.DATE)
           @Column(name = "DATE_ENTERED", length = 7)
           public Date getDateEntered() {
                return this.dateEntered;
           }

           public void setDateEntered(Date dateEntered) {
                this.dateEntered = dateEntered;
           }

           @Column(name = "UPDATED_BY", length = 20)
           @Length(max = 20)
           public String getUpdatedBy() {
                return this.updatedBy;
           }

           public void setUpdatedBy(String updatedBy) {
                this.updatedBy = updatedBy;
           }

           @Temporal(TemporalType.DATE)
           @Column(name = "DATE_UPDATED", length = 7)
           public Date getDateUpdated() {
                return this.dateUpdated;
           }

           public void setDateUpdated(Date dateUpdated) {
                this.dateUpdated = dateUpdated;
           }

           @Column(name = "RATING", precision = 5)
           public BigDecimal getRating() {
                return this.rating;
           }

           public void setRating(BigDecimal rating) {
                this.rating = rating;
           }

           @Column(name = "NO_RATERS", precision = 3, scale = 0)
           public Short getNoRaters() {
                return this.noRaters;
           }

           public void setNoRaters(Short noRaters) {
                this.noRaters = noRaters;
           }

      }
      --------------------------------------------------------------------------------------



      Now the place where I get this error.

      <a4j:form id="taAssignmentForm">
                <rich:panel>
                <s:link action="#{courseSearch.loadAddTaAssignment()}"
                         value="Add TA Assignment"
                   style="font-size: 1em;">
                               
                                                     
                            <f:setPropertyActionListener value="#{var}"
                           target="#{courseSearch.newTaAssignment}" />
                           <s:conversationPropagation type="join" />
                        </s:link>
                <a4j:outputPanel id="taAssignmentsPanel"
                            rendered="#{courseSearch.selectedCourse.taAssignment.size >  0}">
                          <h:panelGrid columns="1" cellspacing="25">
                               <rich:dataTable columns="4" value="

                                                  #{courseSearch.taAssignmentList}"
                                                   var="taAssignment" rows="10" sortMode="single"
                               onRowMouseOver="this.style.backgroundColor='#FFFFAA'"
                               onRowMouseOut="this.style.backgroundColor='#
                                              {a4jSkin.tableBackgroundColor}'">
                                                        
                      <a4j:support action="#{courseSearch.loadTaAssignment()}"
                                       event="onRowClick" reRender="courseViewForm" >
                          <f:setPropertyActionListener value="#{taAssignment}"
                                       target="#{courseSearch.selectedTaAssignment}" />
                                        <s:conversationPropagation type="join"/>
                               </a4j:support>

                                <rich:column id="col1">
                                  <f:facet name="header">
                                    <h:outputText value="Ta_Id" />
                                  </f:facet>
                                   <h:outputText value="#{courseSearch.findTaName(taAssignment.id.taId)}" >
                                   </h:outputText>
                                </rich:column>
                                <rich:column id="col2">
                                  <f:facet name="header">
                                    <h:outputText value="Type" />
                                  </f:facet>
                                   <h:outputText value="#{taAssignment.workTypeCode.description}" />
                                </rich:column>
                                <rich:column id="col3">
                                  <f:facet name="header">
                                    <h:outputText value="Supervisor" />
                                  </f:facet>
                                   <h:outputText value="#{taAssignment.supervisor}" />
                                </rich:column>
                                <rich:column id="col4">
                                  <f:facet name="header">
                                    <h:outputText value="Rate" />
                                  </f:facet>
                                   <h:outputText value="#{taAssignment.payRate}" />
                                </rich:column>
                                 <rich:column id="col5">
                                  <f:facet name="header">
                                    <h:outputText value="Pay Unit" />
                                  </f:facet>
                                   <h:outputText value="#{taAssignment.payUnit.payUnit}" />
                                </rich:column>
                                 <rich:column id="col6">
                                  <f:facet name="header">
                                    <h:outputText value="Notes" />
                                  </f:facet>
                                   <h:outputText value="#{taAssignment.taNotes}" />
                                </rich:column>
                                </rich:dataTable>
                               </h:panelGrid>
                             
                </a4j:outputPanel>
                </rich:panel>
           </a4j:form>
      ------------------------------------------------------------------------------------

      The place where I get it is when I click on a row on the above dataTable.  If you notice,it calls the method loadTaAssignment in the backing bean.

      Let me know if you require the CourseOffering dataObject.  Which has a one to many relationship association to TaAssignment.

      I will paste the association only at this point.

      @OneToMany(cascade = {CascadeType.MERGE, CascadeType.REFRESH})
           @JoinColumns({
               @JoinColumn(name = "SEMESTER", referencedColumnName = "SEMESTER",insertable = false, updatable=false),
               @JoinColumn(name = "COURSE_NO", referencedColumnName = "COURSE_NO", insertable = false, updatable=false),
               @JoinColumn(name = "SECTION", referencedColumnName = "SECTION", insertable = false, updatable=false)
           })
           public Set<TaAssignment> getTaAssignment(){
                return this.taAssignments;
           }

           public void setTaAssignment(Set<TaAssignment> taAssignments){
                this.taAssignments = taAssignments;
           }



      Please let me know if anything is wrong with the entity StuWorkTypes.  And the reason why it says, "Unable to establish the name of the entity class, edu....StuWorkTypes.

      Any suggestions would be very helpful.