Hi Van,
I saw that you have added changes to latest-data.sql, with the new changes
for configuration, where lookup names are required. This means that
upgrading the database to add a new value(s) from java looks problematic
because we are putting an empty space from the insert method
(package org.mifos.framework.persistence; upgrade.jave). See the method
below. Since I am adding a type of interest calc rule, I would like to add
the lookupName as well..
protected int insertLookupValue(Connection connection,
int lookupEntity) throws SQLException {
/* LOOKUP_ID is not AUTO_INCREMENT until database version
121.
Although we perhaps could try to work some magic with the
upgrades, it seems better to just insert in the racy way
until then. Upgrades run single-threaded before the
application allows logins, so I think this is fine. */
int largestLookupId = largestLookupId(connection);
int newLookupId = largestLookupId + 1;
PreparedStatement statement = connection.prepareStatement(
"insert into LOOKUP_VALUE(" +
"LOOKUP_ID,ENTITY_ID,LOOKUP_NAME) " +
"VALUES(?,?,?)");
statement.setInt(1, newLookupId);
statement.setInt(2, lookupEntity);
/* Pretty much all existing code inserts a space here.
I'm not sure this field is used for anything. */
statement.setString(3, " ");
statement.executeUpdate();
statement.close();
return newLookupId;
}
I was able to pass the test realshema in
org.framework.persistance.latestTest.java by overloading the above method.
protected int insertLookupValue(Connection connection,
int lookupEntity, String lookupName) throws
SQLException {
/* With the new configuration the LookupNames should not be
blank*/
int largestLookupId = largestLookupId(connection);
int newLookupId = largestLookupId + 1;
PreparedStatement statement = connection.prepareStatement(
"insert into LOOKUP_VALUE(" +
"LOOKUP_ID,ENTITY_ID,LOOKUP_NAME) " +
"VALUES(?,?,?)");
statement.setInt(1, newLookupId);
statement.setInt(2, lookupEntity);
statement.setString(3, lookupName);
statement.executeUpdate();
statement.close();
return newLookupId;
}
How should this be handled? Please let me know, as my patch submission is
dependent on this.
Thanks
Soham
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/