Hi,
I'm a hibernate newbie and I'm struggling with the error below:
Code:
net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.ubs.eae.database.model.ContractCompBreaks.setNotes
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:212)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2199)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:240)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1536)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.ubs.eae.database.CompareBreaksDAO.getBreakDetails(CompareBreaksDAO.java:304)
... 39 more
Caused by:
net.sf.cglib.beans.BulkBeanException: net.sf.hibernate.collection.Set incompatible with [Ljava.lang.Object;
at com.ubs.eae.database.model.ContractCompBreaks$$BulkBeanByCGLIB$$ff46bf7c.setPropertyValues(<generated>)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:207)
... 48 more
Caused by:
java.lang.ClassCastException: net.sf.hibernate.collection.Set incompatible with [Ljava.lang.Object;
... 50 more
My POJO:
Code:
/**
*
*/
package com.ubs.eae.database.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.ubs.eae.facade.data.BreakNoteDTO;
/**
* @author dipeolay
*
*/
public class ContractCompBreaks implements Serializable {
private int ttid;
private Long id;
private int leId;
private int cptyLeId;
private String contractNumber;
private char contractType;
private String status;
private String secCode;
private String secName;
private String breakType;
private Double ourQty;
private Double ourAmount;
private Double ourRate;
private String ourRateCode;
private String ourRoundingIndicator;
private String ourMarkParameter;
private Boolean isTrackedUs;
private Calendar ourDeliveryDate;
private Double ourDividendTaxRate;
private Double cptyQty;
private Double cptyAmount;
private Double cptyRate;
private String cptyRateCode;
private String cptyRoundingIndicator;
private String cptyMarkParameter;
private Boolean isTrackedCpty;
private Calendar cptyDeliveryDate;
private Double cptyDividendTaxRate;
private String comments;
private Set <BreakNoteDTO> notes;
private Calendar updated;
/**
*
*/
public ContractCompBreaks() {
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
public int getTtid(){
return ttid;
}
public void setTtid(int ttid){
this.ttid = ttid;
}
/**
* @return the breakType
*/
public String getBreakType() {
return breakType;
}
/**
* @param breakType the breakType to set
*/
public void setBreakType(String breakTypes) {
this.breakType = breakTypes;
}
/**
* @return the comments
*/
public String getComments() {
return comments;
}
/**
* @param comments the comments to set
*/
public void setComments(String comments) {
this.comments = comments;
}
/**
* @return the contractNumber
*/
public String getContractNumber() {
return contractNumber;
}
/**
* @param contractNumber the contractNumber to set
*/
public void setContractNumber(String contractNumber) {
this.contractNumber = contractNumber;
}
/**
* @return the contractType
*/
public char getContractType() {
return contractType;
}
/**
* @param contractType the contractType to set
*/
public void setContractType(char contractType) {
this.contractType = contractType;
}
/**
* @return the cptyAmount
*/
public Double getCptyAmount() {
return cptyAmount;
}
/**
* @param cptyAmount the cptyAmount to set
*/
public void setCptyAmount(Double cptyAmount) {
this.cptyAmount = cptyAmount;
}
/**
* @return the cptyDeliveryDate
*/
public Calendar getCptyDeliveryDate() {
return cptyDeliveryDate;
}
/**
* @param cptyDeliveryDate the cptyDeliveryDate to set
*/
public void setCptyDeliveryDate(Calendar cptyDeliveryDate) {
this.cptyDeliveryDate = cptyDeliveryDate;
}
/**
* @return the cptyDividendTaxRate
*/
public Double getCptyDividendTaxRate() {
return cptyDividendTaxRate;
}
/**
* @param cptyDividendTaxRate the cptyDividendTaxRate to set
*/
public void setCptyDividendTaxRate(Double cptyDividendTaxRate) {
this.cptyDividendTaxRate = cptyDividendTaxRate;
}
/**
* @return the cptyMarkParameter
*/
public String getCptyMarkParameter() {
return cptyMarkParameter;
}
/**
* @param cptyMarkParameter the cptyMarkParameter to set
*/
public void setCptyMarkParameter(String cptyMarkParameter) {
this.cptyMarkParameter = cptyMarkParameter;
}
/**
* @return the cptyQty
*/
public Double getCptyQty() {
return cptyQty;
}
/**
* @param cptyQty the cptyQty to set
*/
public void setCptyQty(Double cptyQty) {
this.cptyQty = cptyQty;
}
/**
* @return the cptyRate
*/
public Double getCptyRate() {
return cptyRate;
}
/**
* @param cptyRate the cptyRate to set
*/
public void setCptyRate(Double cptyRate) {
this.cptyRate = cptyRate;
}
/**
* @return the cptyRoundingIndicator
*/
public String getCptyRoundingIndicator() {
return cptyRoundingIndicator;
}
/**
* @param cptyRoundingIndicator the cptyRoundingIndicator to set
*/
public void setCptyRoundingIndicator(String cptyRoundingIndicator) {
this.cptyRoundingIndicator = cptyRoundingIndicator;
}
/**
* @return the isTrackedCpty
*/
public boolean getIsTrackedCpty() {
return isTrackedCpty;
}
/**
* @param isTrackedCpty the isTrackedCpty to set
*/
public void setIsTrackedCpty(boolean isTrackedCpty) {
this.isTrackedCpty = isTrackedCpty;
}
/**
* @return the isTrackedUs
*/
public boolean getIsTrackedUs() {
return isTrackedUs;
}
/**
* @param isTrackedUs the isTrackedUs to set
*/
public void setIsTrackedUs(boolean isTrackedUs) {
this.isTrackedUs = isTrackedUs;
}
/**
* @return the notes
*/
public Set<BreakNoteDTO>getNotes() {
return notes;
}
/**
* @param notes the notes to set
*/
public void setNotes(Set<BreakNoteDTO> notes) {
this.notes = notes;
}
/**
* @return the ourAmount
*/
public Double getOurAmount() {
return ourAmount;
}
/**
* @param ourAmount the ourAmount to set
*/
public void setOurAmount(Double ourAmount) {
this.ourAmount = ourAmount;
}
/**
* @return the ourDeliveryDate
*/
public Calendar getOurDeliveryDate() {
return ourDeliveryDate;
}
/**
* @param ourDeliveryDate the ourDeliveryDate to set
*/
public void setOurDeliveryDate(Calendar ourDeliveryDate) {
this.ourDeliveryDate = ourDeliveryDate;
}
/**
* @return the ourDividendTaxRate
*/
public Double getOurDividendTaxRate() {
return ourDividendTaxRate;
}
/**
* @param ourDividendTaxRate the ourDividendTaxRate to set
*/
public void setOurDividendTaxRate(Double ourDividendTaxRate) {
this.ourDividendTaxRate = ourDividendTaxRate;
}
/**
* @return the ourMarkParameter
*/
public String getOurMarkParameter() {
return ourMarkParameter;
}
/**
* @param ourMarkParameter the ourMarkParameter to set
*/
public void setOurMarkParameter(String ourMarkParameter) {
this.ourMarkParameter = ourMarkParameter;
}
/**
* @return the ourQty
*/
public Double getOurQty() {
return ourQty;
}
/**
* @param ourQty the ourQty to set
*/
public void setOurQty(Double ourQty) {
this.ourQty = ourQty;
}
/**
* @return the ourRate
*/
public Double getOurRate() {
return ourRate;
}
/**
* @param ourRate the ourRate to set
*/
public void setOurRate(Double ourRate) {
this.ourRate = ourRate;
}
/**
* @return the ourRateCode
*/
public String getOurRateCode() {
return ourRateCode;
}
/**
* @param ourRateCode the ourRateCode to set
*/
public void setOurRateCode(String ourRateCode) {
this.ourRateCode = ourRateCode;
}
/**
* @return the ourRoundingIndicator
*/
public String getOurRoundingIndicator() {
return ourRoundingIndicator;
}
/**
* @param ourRoundingIndicator the ourRoundingIndicator to set
*/
public void setOurRoundingIndicator(String ourRoundingIndicator) {
this.ourRoundingIndicator = ourRoundingIndicator;
}
/**
* @return the secCode
*/
public String getSecCode() {
return secCode;
}
/**
* @param secCode the secCode to set
*/
public void setSecCode(String secCode) {
this.secCode = secCode;
}
/**
* @return the secName
*/
public String getSecName() {
return secName;
}
/**
* @param secName the secName to set
*/
public void setSecName(String secName) {
this.secName = secName;
}
/**
* @return the status
*/
public String getStatus() {
return status;
}
/**
* @param status the status to set
*/
public void setStatus(String status) {
this.status = status;
}
public String getCptyRateCode() {
return cptyRateCode;
}
public void setCptyRateCode(String cptyRateCode) {
this.cptyRateCode = cptyRateCode;
}
public int getCptyLeId() {
return cptyLeId;
}
public void setCptyLeId(int cptyLeId) {
this.cptyLeId = cptyLeId;
}
public int getLeId() {
return leId;
}
public void setLeId(int leId) {
this.leId = leId;
}
/**
* @param updated the updated to set
*/
public void setUpdated(Calendar updated) {
this.updated = updated;
}
/**
* @return the updated
*/
public Calendar getUpdated() {
return updated;
}
public int hashCode() {
if (contractNumber == null) return 0;
return contractNumber.hashCode();
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final ContractCompBreaks other = (ContractCompBreaks) obj;
if (contractNumber == null) {
if (other.contractNumber != null)
return false;
} else if (!contractNumber.equals(other.contractNumber))
return false;
return true;
}
}
My mappings file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.ubs.eae.database.model.ContractCompBreaks" table="CONTRACT_COMP_BREAKS">
<id column = "EXTERNAL_REF_ID"
name = "id"
type = "java.lang.Long" >
<generator class="sequence">
<param name="sequence">CONTRACT_COMP_BREAKS_SEQ</param>
</generator>
</id>
<property
column ="INTERNAL_REF_ID"
name = "contractNumber"
type = "java.lang.String"
not-null = "true"
unique = "true"/>
<property
column = "BORROW_LOAN_IND"
name = "contractType"
type = "char"
not-null = "true"/>
<property
column="LEGAL_ENTITY_ID"
name="leId"
not-null="true"
type="int"
/>
<property
column="COUNTERPARTY_LE_ID"
name="cptyLeId"
not-null="true"
type="int"
/>
<property
column="TIMETABLE_ID"
name="ttid"
not-null="true"
type="int"
/>
<property
column="BREAK_TYPE"
name="breakType"
not-null="true"
type="java.lang.String"
/>
<property
column="BREAK_STATUS"
name="status"
not-null="true"
type="java.lang.String"
/>
<property
column="SEC_ID"
name="secCode"
not-null="false"
type="java.lang.String"
/>
<property
column="SEC_NAME"
name="secName"
not-null="false"
type="java.lang.String"
/>
<property
column="QTY_LE"
name="ourQty"
not-null="false"
type="java.lang.Double"
/>
<property
column="QTY_CPTY"
name="cptyQty"
not-null="false"
type="java.lang.Double"
/>
<property
column="RATE_LE"
name="ourRate"
not-null="false"
type="java.lang.Double"
/>
<property
column="RATE_CPTY"
name="cptyRate"
not-null="false"
type="java.lang.Double"
/>
<property
column="RATE_CODE_LE"
name="ourRateCode"
not-null="false"
type="java.lang.String"
/>
<property
column="RATE_CODE_CPTY"
name="cptyRateCode"
not-null="false"
type="java.lang.String"
/>
<property
column="LE_ROUNDING_IND"
name="ourRoundingIndicator"
not-null="false"
type="java.lang.String"
/>
<property
column="CPTY_ROUNDING_IND"
name="cptyRoundingIndicator"
not-null="false"
type="java.lang.String"
/>
<property
column="LE_MARK_PARAMS"
name="ourMarkParameter"
not-null="false"
type="java.lang.String"
/>
<property
column="CPTY_MARK_PARAMS"
name="cptyMarkParameter"
not-null="false"
type="java.lang.String"
/>
<property
column="TRACKED_BY_LE"
name="isTrackedUs"
not-null="false"
type="java.lang.Boolean"
/>
<property
column="TRACKED_BY_CPTY"
name="isTrackedCpty"
not-null="false"
type="java.lang.Boolean"
/>
<property
column="LE_DELIVERY_DATE"
name="ourDeliveryDate"
not-null="false"
type="java.util.Calendar"
/>
<property
column="CPTY_DELIVERY_DATE"
name="cptyDeliveryDate"
not-null="false"
type="java.util.Calendar"
/>
<property
column="LE_DIV_TAX_RATE"
name="ourDividendTaxRate"
not-null="false"
type="java.lang.Double"
/>
<property
column="CPTY_DIV_TAX_RATE"
name="cptyDividendTaxRate"
not-null="false"
type="java.lang.Double"
/>
<property
column="LE_AMOUNT"
name="ourAmount"
not-null="false"
type="java.lang.Double"
/>
<property
column="CPTY_AMOUNT"
name="cptyAmount"
not-null="false"
type="java.lang.Double"
/>
<property
column="COMMENTS"
name="comments"
not-null="false"
type="java.lang.String"
/>
<property
column="UPDATED"
name="updated"
not-null="false"
type="java.util.Calendar"
/>
<set name="notes" table = "CONTRACT_BREAK_NOTES" lazy = "true" inverse ="true" order-by = "NOTE_ID asc">
<key>
<column name ="BREAK_ID"/>
</key>
<one-to-many class="com.ubs.eae.facade.data.BreakNoteDTO"/>
</set>
<!-- <array name="notes" inverse ="false">
<key column ="BREAK_ID"/>
<index column = "NOTE_ID"/>
<one-to-many class="com.ubs.eae.facade.data.BreakNoteDTO"/>
</array>-->
</class>
</hibernate-mapping>
Can someone please help. Thank you very much in advance