com.mysema.query.QueryException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number #1082

Closed
rlecomte opened this Issue Dec 10, 2014 · 6 comments

Comments

Projects
None yet
3 participants
@rlecomte

Hi,

I work on a old mysql schema and i decide to use query dsl to exploit that in an easier way.

Unfortunately, i have column "enabled" with type "tinyint(1)" to represent boolean value. When i launch query dsl maven plugin to generate class, i get this field :

public final NumberPath enabled = createNumber("enabled", Byte.class);

Whatever byte or boolean type. It doesn't matter if it work. But is not and i obtain this class cast exception :

com.mysema.query.QueryException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number

Why column value is map as boolean?

@Shredder121

This comment has been minimized.

Show comment
Hide comment
@Shredder121

Shredder121 Dec 10, 2014

Member

How old are we talking about?
which versions of MySQL and Querydsl do you use?

Member

Shredder121 commented Dec 10, 2014

How old are we talking about?
which versions of MySQL and Querydsl do you use?

@rlecomte

This comment has been minimized.

Show comment
Hide comment
@rlecomte

rlecomte Dec 10, 2014

It work on mysql 5.5 ans i use query dsl 3.5.1

It work on mysql 5.5 ans i use query dsl 3.5.1

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Dec 10, 2014

Member

Could you provide the stacktrace?

Member

timowest commented Dec 10, 2014

Could you provide the stacktrace?

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Dec 10, 2014

Member

@rlecomte I fixed the behaviour in the PR. Could you try it out? Also I got the type mapped to Boolean and not to Byte.

Member

timowest commented Dec 10, 2014

@rlecomte I fixed the behaviour in the PR. Could you try it out? Also I got the type mapped to Boolean and not to Byte.

@timowest timowest added the bug label Dec 10, 2014

@timowest timowest added this to the 4.0.0 milestone Dec 10, 2014

@rlecomte

This comment has been minimized.

Show comment
Hide comment
@rlecomte

rlecomte Dec 11, 2014

Now i still got :

public final NumberPath enabled = createNumber("enabled", Byte.class);

But at runtime it looks be nice. Thank you

Now i still got :

public final NumberPath enabled = createNumber("enabled", Byte.class);

But at runtime it looks be nice. Thank you

@Shredder121 Shredder121 closed this in #1083 Dec 12, 2014

@timowest timowest modified the milestones: 3.6.1, 4.0.0 Dec 17, 2014

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jan 31, 2015

Member

Released in 3.6.1

Member

timowest commented Jan 31, 2015

Released in 3.6.1

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