Changeset 3784


Ignore:
Timestamp:
Sep 25, 2007, 3:08:39 PM (15 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #655: Plugins -> defintions fails with 'illegal attempt to dereference collection'

Location:
trunk/src/core/net/sf/basedb/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Install.java

    r3741 r3784  
    104104    method.
    105105  */
    106   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(42).intValue();
     106  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(43).intValue();
    107107 
    108108  public static synchronized void createTables(boolean update, final ProgressReporter progress)
  • trunk/src/core/net/sf/basedb/core/Update.java

    r3741 r3784  
    474474    <td>40</td>
    475475    <td>
    476       Change invalid property filter on 'guiContexts.itemType' to
    477       '$ctx.itemType'.
     476      Used to "Change invalid property filter on 'guiContexts.itemType' to
     477      '$ctx.itemType'", but since the source problem never was fixed this is now
     478      done in 43.
    478479    </td>
    479480  </tr>
     
    499500      The update will query the database or check the CDF file to get
    500501      the information.
     502    </td>
     503  </tr>
     504 
     505  <tr>
     506    <td>43</td>
     507    <td>
     508      Change invalid property filter on 'guiContexts.itemType' to
     509      '$ctx.itemType'". Was originally fixed by 40, but since the source
     510      problem never was fixed it must be done again.
    501511    </td>
    502512  </tr>
     
    697707        schemaVersion = updateToSchemaVersion39(session);
    698708      }
    699      
    700       if (schemaVersion < 40)
    701       {
    702         if (progress != null) progress.display((int)(39*progress_factor), "--Updating schema version: " + schemaVersion + " -> 40...");       
    703         schemaVersion = updateToSchemaVersion40(session);
    704       }
    705      
     709         
    706710      if (schemaVersion < 41)
    707711      {
     
    714718        if (progress != null) progress.display((int)(41*progress_factor), "--Updating schema version: " + schemaVersion + " -> 42...");
    715719        schemaVersion = updateToSchemaVersion42(session);
     720      }
     721     
     722      if (schemaVersion < 43)
     723      {
     724        if (progress != null) progress.display((int)(42*progress_factor), "--Updating schema version: " + schemaVersion + " -> 43...");       
     725        schemaVersion = updateToSchemaVersion43(session);
    716726      }
    717727
     
    15891599      if (tx != null) HibernateUtil.rollback(tx);
    15901600      log.error("updateToSchemaVersion39: FAILED", ex);
    1591       throw ex;
    1592     }
    1593     return schemaVersion;   
    1594   }
    1595 
    1596   /**
    1597     Update property filter on 'guiContexts.itemType' to '$ctx.itemType'
    1598     @return The new schema version (=40)
    1599   */
    1600   private static int updateToSchemaVersion40(org.hibernate.Session session)
    1601   {
    1602     final int schemaVersion = 40;
    1603     org.hibernate.Transaction tx = null;
    1604     try
    1605     {
    1606       tx = HibernateUtil.newTransaction(session);
    1607  
    1608       // Change property values
    1609       org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session,
    1610           "UPDATE_PROPERTY_FILTER");
    1611       /*
    1612         UPDATE PropertyFilters pf
    1613         SET pf.property = :newProperty
    1614         WHERE pf.property = :oldProperty
    1615        */
    1616       query.setString("oldProperty", "guiContexts.itemType");
    1617       query.setString("newProperty", "$ctx.itemType");
    1618       HibernateUtil.executeUpdate(query);
    1619 
    1620       // Update the schema version number
    1621       setSchemaVersion(session, schemaVersion);
    1622  
    1623       // Commit the changes
    1624       HibernateUtil.commit(tx);
    1625       log.info("updateToSchemaVersion40: OK");
    1626     }
    1627     catch (BaseException ex)
    1628     {
    1629       if (tx != null) HibernateUtil.rollback(tx);
    1630       log.error("updateToSchemaVersion40: FAILED", ex);
    16311601      throw ex;
    16321602    }
     
    17181688  }
    17191689 
    1720  
     1690  /**
     1691    Update property filter on 'guiContexts.itemType' to '$ctx.itemType'
     1692    @return The new schema version (=43)
     1693  */
     1694  private static int updateToSchemaVersion43(org.hibernate.Session session)
     1695  {
     1696    final int schemaVersion = 43;
     1697    org.hibernate.Transaction tx = null;
     1698    try
     1699    {
     1700      tx = HibernateUtil.newTransaction(session);
     1701 
     1702      // Change property values
     1703      org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session,
     1704          "UPDATE_PROPERTY_FILTER");
     1705      /*
     1706        UPDATE PropertyFilters pf
     1707        SET pf.property = :newProperty
     1708        WHERE pf.property = :oldProperty
     1709       */
     1710      query.setString("oldProperty", "guiContexts.itemType");
     1711      query.setString("newProperty", "$ctx.itemType");
     1712      HibernateUtil.executeUpdate(query);
     1713 
     1714      // Update the schema version number
     1715      setSchemaVersion(session, schemaVersion);
     1716 
     1717      // Commit the changes
     1718      HibernateUtil.commit(tx);
     1719      log.info("updateToSchemaVersion40: OK");
     1720    }
     1721    catch (BaseException ex)
     1722    {
     1723      if (tx != null) HibernateUtil.rollback(tx);
     1724      log.error("updateToSchemaVersion40: FAILED", ex);
     1725      throw ex;
     1726    }
     1727    return schemaVersion;   
     1728  }
     1729
    17211730  /**
    17221731    Adjust the existing items in the database to be compatible with the latest mappings.
Note: See TracChangeset for help on using the changeset viewer.