Skip to content
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

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
Labels
bug
Milestone

Comments

@rlecomte
Copy link

@rlecomte rlecomte commented Dec 10, 2014

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
Copy link
Member

@Shredder121 Shredder121 commented Dec 10, 2014

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

@rlecomte
Copy link
Author

@rlecomte rlecomte commented Dec 10, 2014

It work on mysql 5.5 ans i use query dsl 3.5.1

@timowest
Copy link
Member

@timowest timowest commented Dec 10, 2014

Could you provide the stacktrace?

@timowest
Copy link
Member

@timowest 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
Copy link
Author

@rlecomte rlecomte commented Dec 11, 2014

Now i still got :

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

But at runtime it looks be nice. Thank you

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

@timowest 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.