Hi
I need your emergency help
I have a colun named "TK_I_MISPAR_TIK" that is not a primary key but is generated by a trigger and sequence at insert time it look something like that:
@Entity @Table(name = "PARK_TIKIM_IRUR", schema = "SCHEMA!", uniqueConstraints = {}) public class ParkTikimIrur implements java.io.Serializable {
@GenericGenerator(name = "generator", strategy = "com.ladpc.commons.database.sequence.LadpcSequeceGenerator", parameters = { @Parameter(name = "schema", value = "SCHEMA!"), @Parameter(name = "sequence", value = "PT_IRUR_TK_MIS_SIDURI_SEQ") }) @Id @GeneratedValue(generator = "generator") @Column(name = "TK_I_MIS_SIDURI", unique = true, nullable = false, precision = 15, scale = 0) public Long getTkIMisSiduri() { return this.tkIMisSiduri; }
@Generated(GenerationTime.INSERT) @Column(name = "TK_I_MISPAR_TIK" , nullable = false,insertable=false, updatable=false, precision = 15, scale = 0) public Long getTkIMisparTik() { return this.tkIMisparTik; }
when i tried to retrieved the data i got a exception java.lang.ClassCastException: java.lang.Integer at org.hibernate.type.LongType.set(LongType.java:42) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116) at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1707) at org.hibernate.loader.Loader.bindParameterValues(Loader.java:1678) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1563) at org.hibernate.loader.Loader.doQuery(Loader.java:673) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2213) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) at org.hibernate.loader.Loader.list(Loader.java:2099) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
it's seems like hibernate don't know that the type is Long and the inserted value that was 63 from the sequence confusing hibernate to think that is of type Integer
Thank you for your emergency help
Yair
|