Changeset 3597


Ignore:
Timestamp:
Jul 25, 2007, 7:55:39 AM (16 years ago)
Author:
Nicklas Nordborg
Message:

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

Location:
trunk/src/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/common-queries.xml

    r3557 r3597  
    26882688  </query>
    26892689 
     2690  <query id="UPDATE_PROPERTY_FILTER" type="SQL">
     2691    <sql>
     2692      UPDATE [PropertyFilters]
     2693      SET [property] = :newProperty
     2694      WHERE [property] = :oldProperty
     2695    </sql>
     2696    <description>
     2697      An SQL query that changes the property for all PropertyFilters
     2698      with a given value.
     2699    </description>
     2700  </query>
    26902701 
    26912702
  • trunk/src/core/net/sf/basedb/core/HibernateUtil.java

    r3593 r3597  
    13501350    assert session != null : "session == null";
    13511351    assert sql != null : "sql == null";
     1352    sql = sql.replace('[', getDialect().openQuote()).replace(']', getDialect().closeQuote());
    13521353    try
    13531354    {
     
    13681369    assert session != null : "session == null";
    13691370    assert sql != null : "sql == null";
     1371    sql = sql.replace('[', getDialect().openQuote()).replace(']', getDialect().closeQuote());
    13701372    try
    13711373    {
  • trunk/src/core/net/sf/basedb/core/Install.java

    r3596 r3597  
    101101    method.
    102102  */
    103   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(39).intValue();
     103  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(40).intValue();
    104104 
    105105  public static synchronized void createTables(boolean update, final ProgressReporter progress)
  • trunk/src/core/net/sf/basedb/core/Update.java

    r3594 r3597  
    463463      Remove AnyToAny links created by older versions of the
    464464      Base1PluginExecuter plug-in.
     465    </td>
     466  </tr>
     467 
     468  <tr>
     469    <td>40</td>
     470    <td>
     471      Change invalid property filter on 'guiContexts.itemType' to
     472      '$ctx.itemType'.
    465473    </td>
    466474  </tr>
     
    662670      }
    663671     
     672      if (schemaVersion < 40)
     673      {
     674        if (progress != null) progress.display((int)(39*progress_factor), "--Updating schema version: " + schemaVersion + " -> 40...");       
     675        schemaVersion = updateToSchemaVersion40(session);
     676      }
     677     
    664678      /*
    665       if (schemaVersion < 39)
    666       {
    667         if (progress != null) progress.display((int)(39*progress_factor), "--Updating schema version: " + schemaVersion + " -> 40...");
    668         schemaVersion = setSchemaVersionInTransaction(session, 40);
     679      if (schemaVersion < 41)
     680      {
     681        if (progress != null) progress.display((int)(40*progress_factor), "--Updating schema version: " + schemaVersion + " -> 41...");
     682        schemaVersion = setSchemaVersionInTransaction(session, 41);
    669683        - or -
    670         schemaVersion = updateToSchemaVersion40(session);
     684        schemaVersion = updateToSchemaVersion41(session);
    671685      }
    672686      ... etc...
     
    15321546      if (tx != null) HibernateUtil.rollback(tx);
    15331547      log.error("updateToSchemaVersion39: FAILED", ex);
     1548      throw ex;
     1549    }
     1550    return schemaVersion;   
     1551  }
     1552
     1553  /**
     1554    Update property filter on 'guiContexts.itemType' to '$ctx.itemType'
     1555    @return The new schema version (=40)
     1556  */
     1557  private static int updateToSchemaVersion40(org.hibernate.Session session)
     1558  {
     1559    final int schemaVersion = 40;
     1560    org.hibernate.Transaction tx = null;
     1561    try
     1562    {
     1563      tx = HibernateUtil.newTransaction(session);
     1564 
     1565      // Change property values
     1566      org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session,
     1567          "UPDATE_PROPERTY_FILTER");
     1568      /*
     1569        UPDATE PropertyFilters pf
     1570        SET pf.property = :newProperty
     1571        WHERE pf.property = :oldProperty
     1572       */
     1573      query.setString("oldProperty", "guiContexts.itemType");
     1574      query.setString("newProperty", "$ctx.itemType");
     1575      HibernateUtil.executeUpdate(query);
     1576
     1577      // Update the schema version number
     1578      setSchemaVersion(session, schemaVersion);
     1579 
     1580      // Commit the changes
     1581      HibernateUtil.commit(tx);
     1582      log.info("updateToSchemaVersion40: OK");
     1583    }
     1584    catch (BaseException ex)
     1585    {
     1586      if (tx != null) HibernateUtil.rollback(tx);
     1587      log.error("updateToSchemaVersion40: FAILED", ex);
    15341588      throw ex;
    15351589    }
Note: See TracChangeset for help on using the changeset viewer.