-->
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.  [ 4 posts ] 
Author Message
 Post subject: Embedded IllegalArgumentException: argument type mismatch
PostPosted: Wed Aug 15, 2007 8:28 pm 
Newbie

Joined: Wed Aug 01, 2007 6:08 pm
Posts: 13
I am using Hibernate 3.3 with annotations. I have an embedded class (component) that I embed in two different classes. In one of the class, everything is working fine, but in second class I get
Caused by: java.lang.IllegalArgumentException: argument type mismatch [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42) [java] ... 53 more


[java] 2007-08-15 17:16:05,650 [BasicPropertyAccessor] IllegalArgumentException in class: com.amazon.otb.model. PlanningLevelData, setter method of property: category
[java] 2007-08-15 17:16:05,650 [BasicPropertyAccessor] expected type: java.lang.String, actual value: java. lang.Boolean



Here is how my embedded class look like

@Embeddable
public class PlanningLevelData implements Serializable {

@Column(name = "CATEGORY_GROUP", length=96)
public String getCategoryGroup() {
return this.categoryGroup;
}
@Column(name = "CATEGORY", length=96)
public String getCategory() {
return this.category;
}
....

It is working in DataPoint where I have defined it as
@Embedded
public PlanningLevelData getPlanningLevel() {
return this.planningLevelData;
}


But not working in the second class. Here is SQL generated by Hibernate:
[java] Hibernate: select planningle0_.id as id2_, planningle0_.CREATED_BY as CREATED2_2_, planningle0_. CREATION_DATE as CREATION3_2_, planningle0_.LAST_UPDATED_BY as LAST4_2_, planningle0_.LAST_UPDATED_DATE as LAST5_2_, planningle0_.ACTIVE as ACTIVE2_, planningle0_.ID as ID2_, planningle0_.NAME as NAME2_, planningle0_. PARENT_ID as PARENT16_2_, planningle0_.CATEGORY as CATEGORY2_, planningle0_.CATEGORY_GROUP as CATEGORY9_2_, planningle0_.ORG as ORG2_, planningle0_.GL_PRODUCT_GROUP as GL11_2_, planningle0_.SUBCATEGORY as SUBCATE12_2_, planningle0_.SUBCATEGORY_GROUP as SUBCATE13_2_, planningle0_.VENDOR as VENDOR2_, planningle0_.VENDOR_GROUP as VENDOR15_2_ from OTB_PLANNING_LEVELS planningle0_ where planningle0_.ACTIVE=?

The organization is defined as String, so I am not sure where it's finding Boolean.



Another unrelated problem is that when I add setFirstResult and setMaxResults, the SQL generates id column twice and I get column ambiguity problem.

Any ideas?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 6:06 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Do you have any boolean methods in PlanningLevelData or the class its embedded in?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 12:54 pm 
Newbie

Joined: Wed Aug 01, 2007 6:08 pm
Posts: 13
No, actually in that class all fields are strings. Here is stack again:

[java] 2007-08-16 09:51:22,274 [PlanningLevelHibernateDaoTest] Began transaction (1): transaction manager [org.springframework.orm.jpa.JpaTransactionManager@177039]; default rollback = true
[java] Hibernate: select planningle0_.id as id2_0_, planningle0_.CREATED_BY as CREATED2_2_0_, planningle0_.CREATION_DATE as CREATION3_2_0_, planningle0_.LAST_UPDATED_BY as LAST4_2_0_, planningle0_.LAST_UPDATED_DATE as LAST5_2_0_, planningle0_.ACTIVE as ACTIVE2_0_, planningle0_.ID as ID2_0_, planningle0_.NAME as NAME2_0_, planningle0_.PARENT_ID as PARENT16_2_0_, planningle0_.CATEGORY as CATEGORY2_0_, planningle0_.CATEGORY_GROUP as CATEGORY9_2_0_, planningle0_.ORG as ORG2_0_, planningle0_.GL_PRODUCT_GROUP as GL11_2_0_, planningle0_.SUBCATEGORY as SUBCATE12_2_0_, planningle0_.SUBCATEGORY_GROUP as SUBCATE13_2_0_, planningle0_.VENDOR as VENDOR2_0_, planningle0_.VENDOR_GROUP as VENDOR15_2_0_ from OTB_PLANNING_LEVELS planningle0_ where planningle0_.id=?
[java] 2007-08-16 09:51:22,610 [BasicPropertyAccessor] IllegalArgumentException in class: com.amazon.otb.model.PlanningLevelData, setter method of property: category
[java] 2007-08-16 09:51:22,611 [BasicPropertyAccessor] expected type: java.lang.String, actual value: java.lang.Boolean
[java] 2007-08-16 09:51:22,615 [DefaultLoadEventListener] Error performing load command
[java] org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.amazon.otb.model.PlanningLevelData.category
[java] at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104)
[java] at org.hibernate.tuple.component.AbstractComponentTuplizer.setPropertyValues(AbstractComponentTuplizer.java:81)
[java] at org.hibernate.tuple.component.PojoComponentTuplizer.setPropertyValues(PojoComponentTuplizer.java:95)
[java] at org.hibernate.type.ComponentType.setPropertyValues(ComponentType.java:358)
[java] at org.hibernate.type.ComponentType.deepCopy(ComponentType.java:402)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 1:57 pm 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Can you post the rest of the stack trace and the class that's failing.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.