-->
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.  [ 6 posts ] 
Author Message
 Post subject: Problem with AliasToBeanResultTransformer and aggregation
PostPosted: Thu Apr 05, 2007 11:41 am 
Newbie

Joined: Thu Apr 05, 2007 5:56 am
Posts: 13
Hibernate version:
3.2

Full stack trace of any exception that occurs:
Code:
org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com._4d.smart.web.faces.stock.PieceCart.quantiteReserve


Name and version of the database you are using:
Oracle 10g


Hello,

I'm currently using AliasToBeanResultTransformer to map my query to a bean. My criteria query uses the sum aggregation function.

My problem is that the aggregation can be empty and so the sum function return null.

When AliasToBeanResultTransformer try to map the result to my bean, Hibernate throw the PropertyAccessException exception


Any idea to solve my issue?

Thanks in advance,

Nicolas


Last edited by NicolasL on Thu Apr 05, 2007 12:41 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 11:47 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Can't your bean have an object wrapper for quantiteReserve instead of a primitive? Especially if you are using Java5, where the autoboxing/unboxing would automatically handle the primitive->object conversion.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 11:52 am 
Newbie

Joined: Thu Apr 05, 2007 5:56 am
Posts: 13
I've tried to put the two function :
void setQuantiteReserve(Double quantity);
void setQuantiteReserve(double quantity);

Not matter it don't run. It throw always the same exception.

Currently my only solution was to create a class which implement ResultTransformer


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 11:58 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Sorry I was not more clear, the PropertyAccessor in the AliasToBeanResultTransformer uses field level access, and looks to be bypassing the setters. What I originally meant was: is it a problem to define your field as a primitive wrapper instead of a primitive.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 12:09 pm 
Newbie

Joined: Thu Apr 05, 2007 5:56 am
Posts: 13
I've try too and it casts me :

Code:
org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com._4d.smart.web.faces.stock.PieceCart.quantiteReserve
Caused by: java.lang.IllegalArgumentException: argument type mismatch
;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 12:14 pm 
Newbie

Joined: Thu Apr 05, 2007 5:56 am
Posts: 13
Ok, the problem is solved.

I've remplaced Double by Float

Now I just must find why ;)

Thanks for your help Ananasi


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