[jboss-cvs] JBossAS SVN: r73362 - branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 13 14:40:37 EDT 2008


Author: jesper.pedersen
Date: 2008-05-13 14:40:37 -0400 (Tue, 13 May 2008)
New Revision: 73362

Modified:
   branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java
Log:
[JBAS-4431] Revert patch

Modified: branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java	2008-05-13 18:38:32 UTC (rev 73361)
+++ branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java	2008-05-13 18:40:37 UTC (rev 73362)
@@ -1,24 +1,24 @@
 /*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
 package org.jboss.ejb.plugins.cmp.jdbc;
 
 import java.sql.Connection;
@@ -49,7 +49,7 @@
  * JDBCStartCommand creates the table if specified in xml.
  *
  * @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
- * @author <a href="mailto:rickard.oberg at telkel.com">Rickard Öberg</a>
+ * @author <a href="mailto:rickard.oberg at telkel.com">Rickard Oberg</a>
  * @author <a href="mailto:marc.fleury at telkel.com">Marc Fleury</a>
  * @author <a href="mailto:shevlandj at kpi.com.au">Joe Shevland</a>
  * @author <a href="mailto:justin at j-m-f.demon.co.uk">Justin Forder</a>
@@ -323,6 +323,9 @@
                   log.debug("Relation table not created as requested: " + cmrField.getQualifiedTableName());
                }
 
+               // create Indices if needed
+               createCMRIndex(dataSource, cmrField);
+
                if(relationMetaData.getCreateTable())
                {
                   issuePostCreateSQL(dataSource,
@@ -331,11 +334,6 @@
                }
             }
          }
-         if(createdTables.contains(relatedEntity.getEntityName()) || relationMetaData.getAlterTable())
-         {
-            // create Indices if needed
-            createCMRIndex(dataSource, cmrField);
-         }
       }
    }
 
@@ -350,10 +348,9 @@
          EntityBridge relatedEntity = cmrField.getRelatedEntity();
          JDBCRelationMetaData relationMetaData = cmrField.getMetaData().getRelationMetaData();
 
-         if(relationMetaData.isForeignKeyMappingStyle() && (createdTables.contains(relatedEntity.getEntityName()) ||
-                                                            relationMetaData.getAlterTable()))
+         if(relationMetaData.isForeignKeyMappingStyle() && (createdTables.contains(relatedEntity.getEntityName())))
          {
-            createCMRIndex(((JDBCAbstractEntityBridge)cmrField.getRelatedEntity()).getDataSource(), cmrField);
+            createCMRIndex(((JDBCAbstractEntityBridge)relatedEntity).getDataSource(), cmrField);
          }
 
          // Create fk constraint
@@ -445,7 +442,7 @@
       for(int j = 0; j < idxColumns.size(); ++j)
       {
          String idxColumn = (String)idxColumns.get(j);
-         idxColumn = idxColumn.trim();         
+         idxColumn = idxColumn.trim();
          while(idxColumn.startsWith("\""))
          {
             idxColumn = idxColumn.substring(1);
@@ -470,7 +467,8 @@
       mapping.getFunctionSql( new String[]{tableName, fieldName, fieldStructure}, sqlBuf );
       String sql = sqlBuf.toString();
 
-      log.warn( sql );
+      if(log.isDebugEnabled())
+         log.debug("Executing: " + sql);
 
       // suspend the current transaction
       TransactionManager tm = manager.getContainer().getTransactionManager();
@@ -917,8 +915,6 @@
    private void createFKIndex(JDBCRelationshipRoleMetaData metadata, DataSource dataSource, String tableName)
       throws DeploymentException
    {
-      SQLUtil.OldIndexes oldIndexes = SQLUtil.getOldIndexes(tableName, dataSource);
-
       Collection kfl = metadata.getKeyFields();
       Iterator it = kfl.iterator();
       while(it.hasNext())
@@ -926,11 +922,8 @@
          JDBCCMPFieldMetaData fi = (JDBCCMPFieldMetaData) it.next();
          if(metadata.isIndexed())
          {
-            if(!hasIndex(oldIndexes, fi.getColumnName()))
-            {
-               createIndex(dataSource, tableName, fi.getFieldName(), createIndexSQL(fi, tableName));
-               idxCount++;
-            }
+            createIndex(dataSource, tableName, fi.getFieldName(), createIndexSQL(fi, tableName));
+            idxCount++;
          }
       }
    }




More information about the jboss-cvs-commits mailing list