如何解决org.hibernate.property.BasicPropertyAccessor - 类中的IllegalArgumentException:在HIBERNATE中

时间:2013-11-25 09:50:02

标签: java spring hibernate session illegalargumentexception

<hibernate-mapping default-lazy="false">
<class name="org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentBaseData" table="SAM_ASSESSMENTBASE_T">
    <id name="assessmentBaseId" column="ID" type="java.lang.Long" unsaved-value="0">
        <generator class="native">
            <param name="sequence">SAM_ASSESSMENTBASE_ID_S</param>
        </generator>
    </id>

当我要在会话中保存新对象时:

for(int i=0;i<pendingAssessdataList.size();i++)
{
    AssessmentData ad=(AssessmentData)pendingAssessdataList.get(i);                     
    AssessmentData new_a = afq.prepareAssessment(ad, ServerConfigurationService.getServerUrl());
    openSession.save(new_a);
}

org.hibernate.property.BasicPropertyAccessor - IllegalArgumentException in class:org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentBaseData, setter method of property: assessmentBaseId and also raising as org.hibernate.property.BasicPropertyAccessor - expected type: java.lang.Long, actual value: java.lang.Long

例外情况是 openSession.save(new_a);

实际上有什么问题请帮帮我....

堆栈跟踪是:

2013-11-25 14:50:27,308 ERROR http-8081-3 org.hibernate.property.BasicPropertyAccessor - IllegalArgumentException in class: org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentBaseData, setter method of property: assessmentBaseId
2013-11-25 14:50:27,308 ERROR http-8081-3 org.hibernate.property.BasicPropertyAccessor - expected type: java.lang.Long, actual value: java.lang.Long

AssessmentData类:

package org.sakaiproject.tool.assessment.data.dao.assessment;

import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

import org.apache.log4j.Category;
import org.sakaiproject.tool.assessment.data.dao.shared.TypeD;
import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentFeedbackIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.EvaluationModelIfc;
import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc;
//import org.sakaiproject.tool.assessment.facade.TypeFacadeQueriesAPI;
//import org.sakaiproject.tool.assessment.services.PersistenceService;

public class AssessmentBaseData
    implements java.io.Serializable,
               org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentBaseIfc
{
  static Category errorLogger = Category.getInstance("errorLogger");

  private static final long serialVersionUID = 7526471155622776147L;
  private Long assessmentBaseId;
  private Boolean isTemplate;
  private Long parentId;
  private String title;
  private String description;
  private String comments;
  private Long typeId;
  private Integer instructorNotification;
  private Integer testeeNotification;
  private Integer multipartAllowed;
  private Integer status;
  private String createdBy;
  private Date createdDate;
  private String lastModifiedBy;
  private Date lastModifiedDate;
  private AssessmentAccessControlIfc assessmentAccessControl;
  private EvaluationModelIfc evaluationModel;
  private AssessmentFeedbackIfc assessmentFeedback;
  private Set assessmentMetaDataSet;
  private HashMap assessmentMetaDataMap = new HashMap();
  private HashMap assessmentFeedbackMap = new HashMap();
  private Set securedIPAddressSet;

  public AssessmentBaseData() {}

  /**
   * This is a cheap object created for holding just the Id & title. This is
   * by AssessmentFacadeQueries.getTitleXXX() when we only need the Id & title
   * and nothing else. This object is not used for persistence.
   * @param assessmentBaseId
   * @param title
   */
  public AssessmentBaseData(Long assessmentBaseId, String title){
    this.assessmentBaseId = assessmentBaseId;
    this.title = title;
  }

  /**
   * This is another cheap object created for holding just the Id, title &
   * lastModifiedDate. This object is merely used for display. It is not used
   * for persistence.
   */
  public AssessmentBaseData(Long assessmentBaseId, String title,Date lastModifiedDate){
    this.assessmentBaseId = assessmentBaseId;
    this.title = title;
    this.lastModifiedDate = lastModifiedDate;
  }

  /**
   * This is another cheap object created for holding just the Id, title &
   * lastModifiedDate. This object is merely used for display. It is not used
   * for persistence.
   */
  public AssessmentBaseData(Long assessmentBaseId, String title,Date lastModifiedDate, String lastModifiedBy){
        this.assessmentBaseId = assessmentBaseId;
        this.title = title;
        this.lastModifiedDate = lastModifiedDate;
        this.lastModifiedBy = lastModifiedBy;
      }

  public AssessmentBaseData(Long assessmentBaseId, String title,Date lastModifiedDate, Long typeId){
    this.assessmentBaseId = assessmentBaseId;
    this.title = title;
    this.lastModifiedDate = lastModifiedDate;
    this.typeId = typeId;
  }

  public AssessmentBaseData(Boolean isTemplate, Long parentId,
                  String title, String description, String comments,
                  Long typeId,
                  Integer instructorNotification, Integer testeeNotification,
                  Integer multipartAllowed, Integer status, String createdBy,
                  Date createdDate, String lastModifiedBy,
                  Date lastModifiedDate) {
    this.isTemplate = isTemplate;
    this.parentId = parentId;
    this.title = title;
    this.description = description;
    this.comments = comments;
    this.typeId = typeId;
    this.instructorNotification = instructorNotification;
    this.testeeNotification = testeeNotification;
    this.multipartAllowed = multipartAllowed;
    this.status = status;
    this.createdBy = createdBy;
    this.createdDate = createdDate;
    this.lastModifiedBy = lastModifiedBy;
    this.lastModifiedDate = lastModifiedDate;
  }

  public Long getAssessmentBaseId() {
    return this.assessmentBaseId;
  }

  public void setAssessmentBaseId(Long assessmentBaseId) {
    this.assessmentBaseId = assessmentBaseId;
  }

  public Boolean getIsTemplate() {
    return this.isTemplate;
  }

  public void setIsTemplate(Boolean isTemplate) {
    this.isTemplate = isTemplate;
  }

  public Long getParentId() {
    return this.parentId;
  }

  public void setParentId(Long parentId) {
    this.parentId = parentId;
  }

  public String getTitle() {
    return this.title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getDescription() {
    return this.description;
  }

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

  public String getComments() {
    return this.comments;
  }

  public void setComments(String comments) {
    this.comments = comments;
  }

  public Integer getInstructorNotification() {
    return this.instructorNotification;
  }

  public void setInstructorNotification(Integer instructorNotification) {
    this.instructorNotification = instructorNotification;
  }

  public Integer getTesteeNotification() {
    return this.testeeNotification;
  }

  public void setTesteeNotification(Integer testeeNotification) {
    this.testeeNotification = testeeNotification;
  }

  public Integer getMultipartAllowed() {
    return this.multipartAllowed;
  }

  public void setMultipartAllowed(Integer multipartAllowed) {
    this.multipartAllowed = multipartAllowed;
  }

  public Long getTypeId() {
    return this.typeId;
  }

  public void setTypeId(Long typeId) {
    this.typeId = typeId;
  }

  public Integer getStatus() {
    return this.status;
  }

  public void setStatus(Integer status) {
    this.status = status;
  }

  public String getCreatedBy() {
    return this.createdBy;
  }

  public void setCreatedBy(String createdBy) {
    this.createdBy = createdBy;
  }

  public Date getCreatedDate() {
    return this.createdDate;
  }

  public void setCreatedDate(Date createdDate) {
    this.createdDate = createdDate;
  }

  public String getLastModifiedBy() {
    return this.lastModifiedBy;
  }

  public void setLastModifiedBy(String lastModifiedBy) {
    this.lastModifiedBy = lastModifiedBy;
  }

  public Date getLastModifiedDate() {
    return this.lastModifiedDate;
  }

  public void setLastModifiedDate(Date lastModifiedDate) {
    this.lastModifiedDate = lastModifiedDate;
  }

  public AssessmentAccessControlIfc getAssessmentAccessControl() {
    return this.assessmentAccessControl;
  }

  public void setAssessmentAccessControl(AssessmentAccessControlIfc assessmentAccessControl) {
    this.assessmentAccessControl = assessmentAccessControl;
  }

  public EvaluationModelIfc getEvaluationModel() {
    return this.evaluationModel;
  }

  public void setEvaluationModel(EvaluationModelIfc evaluationModel) {
    this.evaluationModel = evaluationModel;
  }

  public AssessmentFeedbackIfc getAssessmentFeedback() {
    return this.assessmentFeedback;
  }

  public void setAssessmentFeedback(AssessmentFeedbackIfc assessmentFeedback) {
    this.assessmentFeedback = assessmentFeedback;
  }

  public Set getSecuredIPAddressSet() {
    return securedIPAddressSet;
  }

  public void setSecuredIPAddressSet(Set securedIPAddressSet) {
    this.securedIPAddressSet = securedIPAddressSet;
  }

  public Set getAssessmentMetaDataSet() {
    return assessmentMetaDataSet;
  }

  public void setAssessmentMetaDataSet(Set assessmentMetaDataSet) {
    this.assessmentMetaDataSet = assessmentMetaDataSet;
    this.assessmentMetaDataMap = getAssessmentMetaDataMap(assessmentMetaDataSet);
  }
}

0 个答案:

没有答案