Hi Dain,

I checked out the latest version and threw away my changes for this bug.
But your change don't work for me. Again there seems to be more than one
created table list.
For me I fixed this by making the Map applicationData in
JBDCStoreManager static.
Otherwise each Instance of JDBCStartCommand calls applicationData.put()
in line 63.

Regards
Frank

Dain Sundstrom schrieb:
> 
>   User: dsundstrom
>   Date: 01/12/27 09:34:33
> 
>   Modified:    src/main/org/jboss/ejb/plugins/cmp/jdbc
>                         JDBCStartCommand.java
>   Log:
>   Fixed bug in created table list, where the tables created by each entity
>   were private to that entity. This was a proble for creation of foreign key
>   constraints in relationships.
>   Changed to use application data container in JDBCStoreManager.
> 
>   Revision  Changes    Path
>   1.12      +21 -7     
>jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java
> 
>   Index: JDBCStartCommand.java
>   ===================================================================
>   RCS file: 
>/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java,v
>   retrieving revision 1.11
>   retrieving revision 1.12
>   diff -u -r1.11 -r1.12
>   --- JDBCStartCommand.java     2001/12/02 01:41:46     1.11
>   +++ JDBCStartCommand.java     2001/12/27 17:34:33     1.12
>   @@ -12,7 +12,10 @@
>    import java.sql.ResultSet;
>    import java.sql.Statement;
>    import java.sql.SQLException;
>   +import java.util.Collections;
>    import java.util.HashSet;
>   +import java.util.Map;
>   +import java.util.Set;
>    import javax.sql.DataSource;
>    import javax.ejb.EJBException;
> 
>   @@ -32,17 +35,16 @@
>     * @author <a href="mailto:[EMAIL PROTECTED]";>Joe Shevland</a>
>     * @author <a href="mailto:[EMAIL PROTECTED]";>Justin Forder</a>
>     * @author <a href="mailto:[EMAIL PROTECTED]";>Michel de Groot</a>
>   - * @version $Revision: 1.11 $
>   + * @version $Revision: 1.12 $
>     */
>    public class JDBCStartCommand {
> 
>   +   private final static Object CREATED_TABLES_KEY = new Object();
>       private JDBCStoreManager manager;
>       private JDBCEntityBridge entity;
>       private JDBCEntityMetaData entityMetaData;
>       private Logger log;
> 
>   -   private HashSet createdTables = new HashSet();
>   -
>       public JDBCStartCommand(JDBCStoreManager manager) {
>          this.manager = manager;
>          entity = manager.getEntityBridge();
>   @@ -53,6 +55,16 @@
>                this.getClass().getName() +
>                "." +
>                manager.getMetaData().getName());
>   +
>   +      // Create the created tables set
>   +      Map applicationData = manager.getApplicationDataMap();
>   +      synchronized(applicationData) {
>   +         if(!applicationData.containsKey(CREATED_TABLES_KEY)) {
>   +            applicationData.put(
>   +                  CREATED_TABLES_KEY,
>   +                  Collections.synchronizedSet(new HashSet()));
>   +         }
>   +      }
>       }
> 
>       public void execute() throws Exception {
>   @@ -134,10 +146,6 @@
> 
>             // commit the transaction
>             manager.getContainer().getTransactionManager().commit ();
>   -
>   -         // success
>   -         log.info("Created table '" + tableName + "' successfully.");
>   -         createdTables.add(tableName);
>          } catch (Exception e) {
>             log.debug("Could not create table " + tableName, e);
>             try {
>   @@ -149,6 +157,11 @@
>             JDBCUtil.safeClose(statement);
>             JDBCUtil.safeClose(con);
>          }
>   +
>   +      // success
>   +      log.info("Created table '" + tableName + "' successfully.");
>   +      Set createdTables = (Set)manager.getApplicationData(CREATED_TABLES_KEY);
>   +      createdTables.add(tableName);
>       }
> 
>       private boolean tableExists(
>   @@ -279,6 +292,7 @@
>             JDBCCMPFieldBridge[] referencesFields) {
> 
>          // can only alter tables we created
>   +      Set createdTables = (Set)manager.getApplicationData(CREATED_TABLES_KEY);
>          if(!createdTables.contains(tableName)) {
>             return;
>          }
> 
> 
> 
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to