[jboss-jira] [JBoss JIRA] Commented: (JBAS-2011) Make table auto-creation create SERIAL columns with Postgresql when using auto-increment feature

Dave Lilley (JIRA) jira-events at lists.jboss.org
Thu Jul 31 16:05:34 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBAS-2011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12423278#action_12423278 ] 

Dave Lilley commented on JBAS-2011:
-----------------------------------

This issue problem also exists in JBossAS-4.0.5GA.  

+++ ./JDBCStartCommand.java
@@ -978,14 +997,18 @@
       // apply auto-increment template
       if(type.getAutoIncrement()[0])
       {
-         String columnClause = SQLUtil.getCreateTableColumnsClause(type);
          JDBCFunctionMappingMetaData autoIncrement =
             manager.getMetaData().getTypeMapping().getAutoIncrementTemplate();
          if(autoIncrement == null)
          {
             throw new IllegalStateException("auto-increment template not found");
          }
-         String[] args = new String[]{columnClause};
+        String[] args = new String[]
+	   {	
+		type.getColumnNames () [0],
+		type.getSQLTypes () [0],
+		type.getNotNull () [0] ? " not null " : ""
+	   };
          autoIncrement.getFunctionSql(args, sqlBuffer);
       }
       else

+++ ./standardjbosscmp-jdbc.xml
@@ -1296,1 +1296,1 @@
-         <auto-increment-template>?1</auto-increment-template>
+         <auto-increment-template>?1 serial</auto-increment-template>

+++ ./standardjbosscmp-jdbc.xml
@@ -1423,1 +1423,1 @@
-         <auto-increment-template>?1</auto-increment-template>
+         <auto-increment-template>?1 serial</auto-increment-template>

+++ ./standardjbosscmp-jdbc.xml
@@ -1550,1 +1550,1 @@
-         <auto-increment-template>?1</auto-increment-template>
+         <auto-increment-template>?1 serial</auto-increment-template>


> Make table auto-creation create SERIAL columns with Postgresql when using auto-increment feature
> ------------------------------------------------------------------------------------------------
>
>                 Key: JBAS-2011
>                 URL: https://jira.jboss.org/jira/browse/JBAS-2011
>             Project: JBoss Application Server
>          Issue Type: Patch
>      Security Level: Public(Everyone can see) 
>          Components: CMP service
>    Affects Versions: JBossAS-4.0.2 Final, JBossAS-4.0.3 Final
>         Environment: FreeBSD,  JBoss 4.0.2, Postgresql
>            Reporter: Jonathan Chen
>            Priority: Optional
>         Attachments: patch-serial-autoinc
>
>   Original Estimate: 30 minutes
>  Remaining Estimate: 30 minutes
>
> If the auto-increment feature is enabled for Postgresql tables, the tables will not be created with the SERIAL attribute.
> A patch to fix this (against 4.0.2, 4.0.3) without invoking post-creation commands is available at:
> http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/java/jboss4/files/patch-serial-autoinc?rev=1.2&content-type=text/plain
> Basically, the patch breaks down the <auto-increment-template> from 1 substitution to 3 substitutions.  This allows the field creation for serial fields in Postgresql (and Informix) to be specified in detail. The patch includes corrections for databases to use the extended format.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list