You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Sandeep Shrivastava (JIRA)" <ji...@apache.org> on 2008/05/16 21:59:55 UTC

[jira] Updated: (OPENJPA-603) Schema Tool discards the size of decimal column

     [ https://issues.apache.org/jira/browse/OPENJPA-603?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandeep Shrivastava updated OPENJPA-603:
----------------------------------------

    Attachment: OPENJPA-603.patch

Removing the DECIMAL column from the fixedSizeTypeNameSet in DBDictionary fixes this problem.

> Schema Tool discards the size of decimal column
> -----------------------------------------------
>
>                 Key: OPENJPA-603
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-603
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.1.0
>         Environment: OpenJPA 1.1.0-SNAPSHOT
> version id: openjpa-1.1.0-SNAPSHOT-r422266:653008
> Apache svn revision: 422266:653008
> os.name: Windows XP
> os.version: 5.1
> os.arch: x86
> java.version: 1.6.0_05
> java.vendor: BEA Systems, Inc.
>            Reporter: Sandeep Shrivastava
>         Attachments: OPENJPA-603.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Run the SchemaTool against the following schema defintion file
> <?xml version='1.0' encoding='UTF-8'?>
> <schemas>
>     <schema>
>         <table name='t2'>
>             <column name='c1' type='integer' type-name='int' size='11'/>
>             <column name='c2' type='varchar' size='50'/>
>             <column name='c3' type='decimal' size='22'/>
>         </table>
>     </schema>
> </schemas>
> Here is the trace log:
> 985  INFO   [Main Thread] openjpa.Tool - Schema tool running action 'add'.  
> This process may take some time.  Enable the org.apache.openjpa.jdbc.Schema logging category to see messages about the collection of schema data, and the org.apache.openjpa.jdbc.SQL category to see generated SQL commands.
> 1078  TRACE  [Main Thread] openjpa.jdbc.SQL - <t 1574411, conn 3516148> 
> executing stmnt 4762292 CREATE TABLE t2 (c1 int(11), c2 VARCHAR(50), c3 DECIMAL) TYPE =innodb
> 1297  TRACE  [Main Thread] openjpa.jdbc.SQL - <t 1574411, conn 3516148> [219 ms] spent
> 1297  INFO   [Main Thread] openjpa.Tool - Recording schema changes.
> 1313  INFO   [Main Thread] openjpa.jdbc.JDBC - Shutting down connection pool.
> The size argument is not ignored and database specific defaults apply. In mySQL it defaults to decimal(10,0) whereas for db2 the default is decimal(5,0) as per the IBM docs.
> This is because the DECIMAL type is present in the set of fixedSizeTypeNameSet in the DBDictionary class. During the create table sql construction, the appendSize method skips adding the size for column types in the fixedSizeTypeNameSet.
> protected String appendSize(Column col, String typeName) {
>         if (fixedSizeTypeNameSet.contains(typeName.toUpperCase()))
>             return typeName;
>         // Rest of method ...
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.