Tune JDBC numeric mappings #578

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

Comments

Projects
None yet
4 participants
@timowest
Member

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Dec 4, 2013

Member

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
Member

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

This comment has been minimized.

Show comment
Hide comment
@danieljue

danieljue 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.

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Dec 5, 2013

Member

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
Member

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

This comment has been minimized.

Show comment
Hide comment
@danieljue

danieljue Dec 6, 2013

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

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

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Dec 12, 2013

Member

Released in 3.3.0.BETA2

Member

timowest commented Dec 12, 2013

Released in 3.3.0.BETA2

@timowest timowest closed this Dec 12, 2013

@dmiorandi

This comment has been minimized.

Show comment
Hide comment
@dmiorandi

dmiorandi 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?

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jan 7, 2014

Member

@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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@dmiorandi

dmiorandi 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/mysema/querydsl/issues/578#issuecomment-31767388
.

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/mysema/querydsl/issues/578#issuecomment-31767388
.

@jjzazuet

This comment has been minimized.

Show comment
Hide comment
@jjzazuet

jjzazuet 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!

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