* add "TableName_UU" uuid secondary key support.

This commit is contained in:
Heng Sin Low 2010-07-19 02:27:54 +08:00
parent 1be6844703
commit 970ae6b62a
1 changed files with 28 additions and 16 deletions

View File

@ -31,6 +31,7 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
@ -2562,6 +2563,17 @@ public abstract class PO
m_IDs[0] = new Integer(no); m_IDs[0] = new Integer(no);
set_ValueNoCheck(m_KeyColumns[0], m_IDs[0]); set_ValueNoCheck(m_KeyColumns[0], m_IDs[0]);
} }
//uuid secondary key
int uuidIndex = p_info.getColumnIndex(get_TableName()+"_UU");
if (uuidIndex >= 0)
{
String value = (String)get_Value(uuidIndex);
if (p_info.getColumn(uuidIndex).FieldLength == 36 && (value == null || value.length() == 0))
{
UUID uuid = UUID.randomUUID();
set_ValueNoCheck(p_info.getColumnName(uuidIndex), uuid.toString());
}
}
if (m_trxName == null) if (m_trxName == null)
log.fine(p_info.getTableName() + " - " + get_WhereClause(true)); log.fine(p_info.getTableName() + " - " + get_WhereClause(true));
else else