org.hibernate.PropertyAccessException:调用setter时发生IllegalArgumentException

时间:2015-11-26 16:52:47

标签: java hibernate

我在尝试获取实体列表时得到],这是1-n关联的n侧。

这是例外

PropertyAccessException

DB

org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.upload.model.UploadFeeEntryItem.uploadFile
11:03:48,883 ERROR [stderr] (http-/127.0.0.1:8443-1)    at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104)
11:03:48,899 ERROR [stderr] (http-/127.0.0.1:8443-1)    at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337)

DAO:

CREATE TABLE UPLOAD_FEE_ENTRY (
UPLOAD_ID NUMBER NOT NULL PRIMARY KEY,
NUMBER_OF_RECORDS NUMBER(4,0),
STATUS VARCHAR2(50 BYTE),
USER_ID VARCHAR2(50 BYTE),
UPLOAD_DATE_TIME TIMESTAMP(6)
);

CREATE TABLE UPLOAD_FEE_ENTRY_ITEM (
UPLOAD_ITEM_ID NUMBER NOT NULL PRIMARY KEY,
UPLOAD_ID NUMBER NOT NULL,
RECORD_ID NUMBER(4,0) NOT NULL,
ERRORS VARCHAR2(255 BYTE),
SENDER  VARCHAR2(50 BYTE) NOT NULL,
CUSTOMER_ID VARCHAR2(50 BYTE) NOT NULL,
ACCOUNT_NUMBER  VARCHAR2(50 BYTE) NOT NULL,
ROUTING_NUMBER  VARCHAR2(50 BYTE),
CONSTRAINT FK_UPLOAD_FEE_ENTRY
    FOREIGN KEY (UPLOAD_ID)
    REFERENCES UPLOAD_FEE_ENTRY(UPLOAD_ID)
);

Java类UploadEntry:

@Transactional(propagation = Propagation.REQUIRED)
public List<UploadFeeEntryItem> getAllFileRecords(int pageNumber,int pageSize, Long fileId) throws DAOException 
{
    log.debug("get getAllFileRecords records");
    try {

        List<UploadFeeEntryItem> instance = (List<UploadFeeEntryItem>) sessionFactory.getCurrentSession().createCriteria("com.wf.fx.ibh.upload.model.UploadFeeEntryItem").list();

        return instance;
    } catch (Exception e) {
        e.printStackTrace();
        throw new DAOException("Exception in " + this.getClass() + ", method - getAllFileRecords() ", e);
    }
}

这是hbm文件:

UploadFileEntry hbm file

UploadEntryItem Java类:

public class UploadFeeEntry implements java.io.Serializable {

    private static final long serialVersionUID = -1368178586515061456L;

    private Long uploadId;
    private Integer numberOfRecords;
    private String status;
    private String userId;
    private Date uploadDateTime;
    private Set<UploadFeeEntryItem> feeEntryItems;

    public Long getUploadId() {
        return uploadId;
    }
    public void setUploadId(Long uploadId) {
        this.uploadId = uploadId;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    @JsonSerialize(using=JsonDateSerializer.class)
    public Date getUploadDateTime() {
        return uploadDateTime;
    }
    public void setUploadDateTime(Date uploadDateTime) {
        this.uploadDateTime = uploadDateTime;
    }
    @JsonIgnore
    public Set<UploadFeeEntryItem> getFeeEntryItems() {
        return feeEntryItems;
    }
    public void setFeeEntryItems(Set<UploadFeeEntryItem> feeEntryItems) {
        this.feeEntryItems = feeEntryItems;
    }
    public Integer getNumberOfRecords() {
        return numberOfRecords;
    }

UploadFileEntryItem hbm file

0 个答案:

没有答案