Hi,After upgrading to 3.2.2 I have now the error (in my own code) :java.lang.Double cannot be cast to java.math.BigDecimalThis is because the returned type is not the same as before.
I think it might be related to this issue:Is there an easy way to solve the problem? I don't want to change the type of my data, ans there is no ".bigDecimalValue()" function
--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
if (value != null && value instanceof Double) {
myValue = new BigDecimal((Double) value);
}
else {
myValue = (BigDecimal) value;
}
Hi.
final List<Object[]> resultS = queryS.list(Projections.array(Object[].class,
selectedNumberPaths.values().toArray(new SimpleExpression[selectedNumberPaths.size()])));
Hi.
Is the expression type you use to project your results Double or BigDecimal?
Br,
Timo
On Wed, Aug 14, 2013 at 10:14 PM, Ghalleb via Querydsl <querydsl+noreply-APn2wQeX0-G4DIGcv7WYJSLQBL8vAtw168CK8NZ6Bpg...@googlegroups.com> wrote:
Hi Timo,My code is too complicated to be all written here...In a nutshell:I have several queries on several tables.I make an Union with all of them and I use a final aggregation (sum() or avg()) on some columns.Before QueryDSL used so give me BigDecimal type Object, but now I have Double Type Object.So later I have a CastClass exception.It was an easy fix in my own code:if (value != null && value instanceof Double) {
myValue = new BigDecimal((Double) value);
}
else {
myValue = (BigDecimal) value;
}
But it seems to be kind of a regression....
Le mercredi 14 août 2013 15:03:33 UTC-4, Timo Westkämper a écrit :
Hi.
List<SimpleExpression<?>> queryFields = new LinkedList<SimpleExpression<?>>();;
queryFields.add(STable.table.myfield.coalesce(new Long(0)).asNumber()
.add(STable.table.myfield2.coalesce(new Long(0))).as("myfieldvar"));
myfield (and myfield2):
public final NumberPath<Long> myfield = createNumber("myfield", Long.class);
Hi.
What about the specific column that has now a different type? What expression did you use for it?
Timo
On Wed, Aug 14, 2013 at 10:32 PM, Ghalleb via Querydsl <querydsl+noreply-APn2wQeX0-G4DIGcv7WYJSLQBL8vAtw168CK8NZ6Bpg...@googlegroups.com> wrote:
final List<Object[]> resultS = queryS.list(Projections.array(Object[].class,
selectedNumberPaths.values().toArray(new SimpleExpression[selectedNumberPaths.size()])));
Le mercredi 14 août 2013 15:28:48 UTC-4, Timo Westkämper a écrit :
Hi.
Is the expression type you use to project your results Double or BigDecimal?
Br,
Timo
Hi.
But these are all Long typed columns. Does any of those cause the error?
I really need more details to be of any help here.
Br,
Timo
On Wed, Aug 14, 2013 at 10:41 PM, Ghalleb via Querydsl <querydsl+noreply-APn2wQeX0-G4DIGcv7WYJSLQBL8vAtw168CK8NZ6Bpg...@googlegroups.com> wrote:
List<SimpleExpression<?>> queryFields = new LinkedList<SimpleExpression<?>>();;
queryFields.add(STable.table.myfield.coalesce(new Long(0)).asNumber()
.add(STable.table.myfield2.coalesce(new Long(0))).as("myfieldvar"));
myfield (and myfield2):
public final NumberPath<Long> myfield = createNumber("myfield", Long.class);
Le mercredi 14 août 2013 15:33:23 UTC-4, Timo Westkämper a écrit :
Hi.
What about the specific column that has now a different type? What expression did you use for it?
Timo
I think the aggregation cause this to return a BigDecimal / Double value.For me right now it's not a big deal because I already fixed it by creating a new BigDecimal variable when it's a Double value, but other people might have the same problem.
Perhaps a .bigDecimalValue() function could be usefull like .longValue() or .doubleValue()
Hi.
On Wed, Aug 14, 2013 at 10:53 PM, Ghalleb via Querydsl <querydsl+noreply-APn2wQeX0-G4DIGcv7WYJSLQBL8vAtw168CK8NZ6Bpg...@googlegroups.com> wrote:
I think the aggregation cause this to return a BigDecimal / Double value.For me right now it's not a big deal because I already fixed it by creating a new BigDecimal variable when it's a Double value, but other people might have the same problem.
But the new Querydsl behaviour is in fact more consistent, as the return type is the same as the expression type.
Perhaps a .bigDecimalValue() function could be usefull like .longValue() or .doubleValue()
Could you create a ticket for that?
Br,
Timo
Le mercredi 14 août 2013 15:46:00 UTC-4, Timo Westkämper a écrit :
Hi.
But these are all Long typed columns. Does any of those cause the error?
I really need more details to be of any help here.
Br,
Timo
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+unsubscribe@googlegroups.com.