Registering numeric type for Boolean in Oracle does not work if Boolean value is null #921

Closed
laurimak opened this Issue Sep 2, 2014 · 5 comments

Projects

None yet

3 participants

@laurimak
laurimak commented Sep 2, 2014

Registering Booleans to be converted to number type does not work with the following configuration.

com.mysema.query.sql.Configuration configuration = new com.mysema.query.sql.Configuration(templates());
        configuration.registerNumeric(1, 0, Boolean.class);

This result in IllegalArgumentException in insert statement as follows.

Caused by: java.lang.IllegalArgumentException: java.sql.SQLException: Invalid column type: 16
    at com.mysema.query.sql.dml.AbstractSQLClause.setParameters(AbstractSQLClause.java:83) ~[querydsl-sql-3.2.4.jar:na]
    at com.mysema.query.sql.dml.SQLInsertClause.prepareStatementAndSetParameters(SQLInsertClause.java:274) ~[querydsl-sql-3.2.4.jar:na]
    at com.mysema.query.sql.dml.SQLInsertClause.createStatement(SQLInsertClause.java:235) ~[querydsl-sql-3.2.4.jar:na]
    at com.mysema.query.sql.dml.SQLInsertClause.execute(SQLInsertClause.java:313) ~[querydsl-sql-3.2.4.jar:na]

Configuring Boolean to numeric mapping in the following manner seems to be a workaround for this problem.

com.mysema.query.sql.Configuration configuration = new com.mysema.query.sql.Configuration(templates());
        configuration.register(new BooleanType(Types.NUMERIC));
@timowest
Member
timowest commented Sep 2, 2014

Thanks for the issue. Which version of Querydsl do you use?

@laurimak
laurimak commented Sep 2, 2014

Sorry, forgot to mention the version in my haste. The Querydsl version is 3.2.4.

@timowest
Member
timowest commented Sep 2, 2014

Ok. Could you also provide the full stacktrace?

@timowest
Member
timowest commented Sep 8, 2014

Instead of the full stacktrace you can of course also provide something with the relevant call. The stacktrace you gave me is a wrapped one.

@timowest timowest added the bug label Dec 14, 2014
@timowest timowest added this to the 4.0.0 milestone Dec 14, 2014
@Shredder121 Shredder121 closed this in #1087 Dec 19, 2014
@timowest timowest removed the progress label Mar 13, 2015
@RazmikMkrtchyan
RazmikMkrtchyan commented Dec 15, 2016 edited

untitled
I think the bug is still actual.
I use Oracle and if my Boolean values are null,then occured java.sql.SQLException: Invalid column type: 16:

p.s. I am using the 3.7.4 version.

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