New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different types returned for production code (Oracle) and in integration tests (HSQLDB) #448

Closed
perkoren opened this Issue Jun 26, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@perkoren

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.

Because writing integration tests using HSQLDB is so common, it would be good if one could override HSQLDB custom types with the ones used in production environment.

Additional note:
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.

BR,

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jul 1, 2013

Member

Could you try again with the latest SNAPSHOT https://oss.sonatype.org/content/repositories/snapshots/

Member

timowest commented Jul 1, 2013

Could you try again with the latest SNAPSHOT https://oss.sonatype.org/content/repositories/snapshots/

timowest added a commit that referenced this issue Jul 1, 2013

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jul 29, 2013

Member

Released in 3.2.2

Member

timowest commented Jul 29, 2013

Released in 3.2.2

@timowest timowest closed this Jul 29, 2013

@timowest timowest added this to the 3.2.2 milestone Apr 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment