BigDecimal vs BigInteger in production code (Oracle) and in JUnit tests (HSQLDB)

259 views
Skip to first unread message

perkoren

unread,
Jun 3, 2013, 9:26:52 AM6/3/13
to quer...@googlegroups.com
Hi, 

after upgrading from 2.3.1.to QueryDSL 3.1.1 (in 3.2.0 this also happens) I have type mismatch in query projection. Production code uses  OracleTemplates and for a long value it returns BigDecimal in AbstractJPASQLQuery#getResultList, whereas in integration Junit tests that use HsqlDB the same column is mapped to BigInteger which results in error:

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysema.query.types.ConstructorExpression.newInstance(ConstructorExpression.java:162)

I tried using the same template in JUnit tests (OracleTemplates instead of HSQLDBTemplates, but to no avail). 
I also created custom HSQLDB template with overriden class2type (the same way as in OracleTemplates), but also to no avail.

Thanks for suggesting how to properly construct JUnits in this case.
BR,

Timo Westkämper

unread,
Jun 3, 2013, 10:40:55 AM6/3/13
to Querydsl on behalf of perkoren
Hi.

What kind of query are you using in this case?

Timo

--
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.
 
 



--
Timo Westkämper
Mysema Oy
+358 (0)40 591 2172
www.mysema.com


perkoren

unread,
Jun 3, 2013, 4:52:55 PM6/3/13
to quer...@googlegroups.com
I'm using custom extension of QueryBase. It uses it's orderBy method. Then I'm using AbstractJPASQLQuery#list method. Generated SQL is +/- as follows:

select col1, col2, col3, ..
from T_FIELD field
join T_FIELD_LINK fieldLink
on field.FIELD_ID = fieldLink.FIELD_ID
where fieldLink.Rep_ID = ? and fieldLink.A_NUMBER is not null
order by fieldLink.A_NUMBER asc

Then in AbstractJPASQLQuery#getResultList(Query query) I see that in the query.getResultList() method everywhere where in production code BigDecimal is returned, in HSQLDB integration test I get BigInteger instead. 

Timo Westkämper

unread,
Jun 8, 2013, 3:48:11 PM6/8/13
to quer...@googlegroups.com
Hi.


On Monday, June 3, 2013 11:52:55 PM UTC+3, perkoren wrote:
I'm using custom extension of QueryBase. It uses it's orderBy method. Then I'm using AbstractJPASQLQuery#list method. Generated SQL is +/- as follows:

select col1, col2, col3, ..
from T_FIELD field
join T_FIELD_LINK fieldLink
on field.FIELD_ID = fieldLink.FIELD_ID
where fieldLink.Rep_ID = ? and fieldLink.A_NUMBER is not null
order by fieldLink.A_NUMBER asc

Then in AbstractJPASQLQuery#getResultList(Query query) I see that in the query.getResultList() method everywhere where in production code BigDecimal is returned, in HSQLDB integration test I get BigInteger instead. 

Could you create a ticket for this on GitHub?

Br,
Timo
 
Reply all
Reply to author
Forward
0 new messages