}
}
private Object loadField(int i)
{
JDBCCMPFieldBridge2 field = (JDBCCMPFieldBridge2)entity.getFields().get(i);
StringBuffer query = new StringBuffer();
query.append("select ")
.append(field.getColumnName())
.append(" from ")
.append(tableName)
.append(" where ");
JDBCCMPFieldBridge2[] pkFields = (JDBCCMPFieldBridge2[])entity.getPrimaryKeyFields();
for(int pkI = 0; pkI < pkFields.length; ++pkI)
{
if(pkI > 0)
{
query.append(" and ");
}
query.append(pkFields[pkI].getColumnName()).append("=?");
}
if(log.isDebugEnabled())
{
log.debug("executing: " + query.toString());
}
Object value = null;
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try
{
con = dataSource.getConnection();
ps = con.prepareStatement(query.toString());
for(int pkI = 0; pkI < pkFields.length; ++pkI)
{
JDBCCMPFieldBridge2 pkField = pkFields[pkI];
Object fieldValue = fields[pkField.getRowIndex()];
pkField.setArgumentParameters(ps, pkI + 1, fieldValue);
}
rs = ps.executeQuery();
if(!rs.next())