Issue Type: Improvement Improvement
Affects Versions: 4.0.0.CR1
Assignee: Unassigned
Components: reverse-engineer
Created: 11/Dec/12 8:49 AM
Description:

Hi all,

we use hibernate-tools in order to generate Hibernate mapping files and have implemented our own reverse engineering strategy. Now I have come across some peculiarities regarding the NUMBER type.

Side remark: The impact of the behaviour described below will become evident when implementing an alternate reverse engineering strategy that maps a BigInteger when the scale is zero and a BigDecimal otherwise.

The issues:
1) A number type can have a precision and a scale. When no precision is given, e.g. in NUMBER(*,2), then hibernate-tools will take the data length of the NUMBER field as the default column size. In my testcases the data length was always 22 bytes. I think a better choice for the default column size would be the maximum allowed precision, i.e. 38.

2) When no precision and scale are given for the NUMBER field, then Oracle will store the value as is, meaning with an arbitrary number of decimal places. Hibernate-tools will default to a precision of 22 and zero decimal digits (because null will become zero in the default case). I would suggest setting precision and scale to 38.

I have added two corresponding pull requests on Github and would really appreciate your comments.

With kind regards,

Thorsten Schäfer

Environment: hibernate-core-4.1.8.Final,
Oracle XE 11.2.0.2.0
Project: Hibernate Tools
Labels: oracle hibernate-tools
Priority: Minor Minor
Reporter: Thorsten Schäfer
Original Estimate: 10m
Remaining Estimate: 10m
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira