-->
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: BasicPropertyAccessor error: misleading?
PostPosted: Wed Apr 18, 2007 5:24 pm 
Newbie

Joined: Wed Apr 18, 2007 4:51 pm
Posts: 2
Hibernate version:
Hibernate 3.2.0.ga


Mapping documents:
The only part that is relevant is the id field that is being set by a database sequence:

<id name="Id" column="ALLERGY_ID" type="java.lang.Long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">ALLERGIES_SEQ</param>
</generator>
</id>


Code between sessionFactory.openSession() and session.close():
It's spread across interceptors and POJO code, but it looks something like:

Session session = sessionFactory.getCurrentSession();
session.save(allergy);
session.flush();



Exception that occurs:
13:57:51,448 ERROR [BasicPropertyAccessor] IllegalArgumentException in class: org.medicalert.mars.model.Allergy, setter method of property: Id
13:57:51,448 ERROR [BasicPropertyAccessor] expected type: java.lang.Long, actual value: java.lang.Long


Name and version of the database you are using:
Oracle10.2.0.1.0


The generated SQL (show_sql=true):
Hibernate: select ALLERGIES_SEQ.nextval from dual


Debug level Hibernate log excerpt:
INFO


As you can see the id of the class in question is bound to a database sequence that is suppossed to automatically fill it in on insert, but instead it's throwing this error. What really confuses me here is the line expected type: java.lang.Long, actual value: java.lang.Long. If the data type it expected is the data type it found, then what is the problem? Am I looking at a misleading error message here? Any insight would be appreciated. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 18, 2007 11:12 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Need to see the POJO.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 19, 2007 3:05 pm 
Newbie

Joined: Wed Apr 18, 2007 4:51 pm
Posts: 2
I've figured out what the problem was. Long story short, I had two libraries (a jar and a war) on my classpath, each of which had their own copy of the persistent classes that I was mapping hibernate to. Apparently these duplicates somehow confused hibernate when BasicPropertyAccessor invoked the setId method on my class (it uses reflection looks like). And yes, this error was very misleading, but what can you do I guess. Thanks for the help anyways.


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.