-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: ClassCastException using sequence.
PostPosted: Wed Jun 23, 2004 4:34 pm 
Newbie

Joined: Wed Jun 23, 2004 4:12 pm
Posts: 2
Can someone please help. I have read multiple post on this subject and tried to find relief in the reference manual, but nothing helps.

I'm getting this error.

There was 1 error:
1) testInsertHighestDegreeList(org.ihets.ims.dao.hibernate.HibernateInquiryListsDaoTest)java.lang.ClassCastException
at net.sf.hibernate.type.LongType.set(LongType.java:32)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
at net.sf.hibernate.loader.Loader.bindPositionalParameters(Loader.java:674)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:713)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:836)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:856)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2113)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1987)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1916)
at org.springframework.orm.hibernate.HibernateTemplate$3.doInHibernate(HibernateTemplate.java:198)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
at org.springframework.orm.hibernate.HibernateTemplate.load(HibernateTemplate.java:196)
at org.ihets.ims.dao.hibernate.HibernateInquiryListsDao.insertHighestDegreeList(Unknown Source)
at org.ihets.ims.dao.hibernate.HibernateInquiryListsDaoTest.testInsertHighestDegreeList(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)





This is my mapping:

<class name="org.ihets.ims.HighestDegree" table="HighestDegree">
<id name="pk" type="long" column="pk">
<generator class="sequence">
<param name="sequence">highestDegree_pk_seq</param>
</generator>
</id>
<property name="value" column="value" type="string"/>
</class>



This is my class:

public class HighestDegree implements Serializable {

/** identifier field */
private Long pk;

/** nullable persistent field */
private String value;

/** full constructor */
public HighestDegree(String value) {
this.value = value;
}

/** default constructor */
public HighestDegree() {
}

public Long getPk() {
return this.pk;
}

public void setPk(Long pk) {
this.pk = pk;
}

public String getValue() {
return this.value;
}

public void setValue(String value) {
this.value = value;
}

public String toString() {
return new ToStringBuilder(this)
.append("pk", getPk())
.toString();
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 4:47 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
try changing
<id name="pk" type="long" column="pk">

to
<id name="pk" column="pk">

type is not the same on your mapping and pojo

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 4:52 pm 
Newbie

Joined: Wed Jun 23, 2004 4:12 pm
Posts: 2
Im sorry I was totally useing the wrong method. I should not have been using the load method.

Newbe.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.