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

Tune JDBC numeric mappings #578

Closed
timowest opened this issue Nov 30, 2013 · 9 comments
Closed

Tune JDBC numeric mappings #578

timowest opened this issue Nov 30, 2013 · 9 comments
Milestone

Comments

@timowest
Copy link
Member

@timowest timowest commented Nov 30, 2013

Tune JDBC numeric mappings. The mapping for numeric(1,0) might need to be reconsidered.

Related:
http://stackoverflow.com/questions/20288414/querydsl-how-to-apply-type-mappings-via-the-querydsl-maven-plugin/20301986#20301986
#535
#513

timowest added a commit that referenced this issue Dec 4, 2013
@timowest
Copy link
Member Author

@timowest timowest commented Dec 4, 2013

The new numeric mappings are

    10-...,0   -> Long
    5-9,0      -> Integer
    3-4,0      -> Short
    2,0        -> Byte
    0-1        -> Boolean
    17-...,?   -> BigDecimal
    0-16,?     -> Double
@danieljue
Copy link

@danieljue danieljue commented Dec 5, 2013

I haven't looked at the code you modified, but it may help to have one more mapping available:

18-...,0 -> BigInteger
Max/Min long value is 9223372036854775807 and -9223372036854775808, which are 19 digits, 18 of which are fully usable.

@timowest
Copy link
Member Author

@timowest timowest commented Dec 5, 2013

Ok, the updated mappings should then probably be

    19,0       -> BigInteger
    10-18,0    -> Long
    5-9,0      -> Integer
    3-4,0      -> Short
    2,0        -> Byte
    0-1,0      -> Boolean
    17-...,?   -> BigDecimal
    0-16,?     -> Double
timowest added a commit that referenced this issue Dec 5, 2013
@danieljue
Copy link

@danieljue danieljue commented Dec 6, 2013

Yes, that is more correct. :-) Thank you.

@timowest
Copy link
Member Author

@timowest timowest commented Dec 12, 2013

Released in 3.3.0.BETA2

@timowest timowest closed this Dec 12, 2013
@dmiorandi
Copy link

@dmiorandi dmiorandi commented Jan 7, 2014

Hi Timo,
in #513 you have added Boolean support. Now is seems that Boolean was removed. It seems that
Boolean cannot be generated from this mapping because
DIGITS = 0 && SIZE=0 ==> BigInteger. The "else {return Boolean.class;" seems to be unreachable.

Am I missing something in previous discussion?

@timowest
Copy link
Member Author

@timowest timowest commented Jan 7, 2014

@dmiorandi Yes, Boolean is unreachable, I can remove this part. There is a previous ticket where NUMERIC(0,0) was suggested to be mapped to Long/BigInteger #535

For Boolean mapping you need overrides. The problem is that NUMERIC(1,0) covers values that cannot be described with Boolean.

@dmiorandi
Copy link

@dmiorandi dmiorandi commented Jan 7, 2014

Ok
Il 07/gen/2014 19:59 "Timo Westkämper" notifications@github.com ha
scritto:

Yes, Boolean is unreachable, I can remove this part. There is a previous
ticket where NUMERIC(0,0) was suggested to be mapped to Long/BigInteger
#535 #535

For Boolean mapping you need overrides.


Reply to this email directly or view it on GitHubhttps://github.com//issues/578#issuecomment-31767388
.

@jjzazuet
Copy link

@jjzazuet jjzazuet commented Jul 15, 2015

Um, naive question here but then, how can I use overrides to map boolean types to NUMERIC(0-1,0)? Any help or pointers appreciated. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants