OPENJPA-736: Restore method signatures per Albert's request

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@773666 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Milosz Tylenda 2009-05-11 19:51:39 +00:00
parent 5014430b94
commit c26d742712
1 changed files with 9 additions and 7 deletions

View File

@ -125,7 +125,8 @@ public class PreparedStatementManagerImpl
sql).getMessage());
}
if (autoAssignColNames != null)
populateAutoAssignCols(stmnt, autoAssign, row);
populateAutoAssignCols(stmnt, autoAssign, autoAssignColNames,
row);
else {
StateManagerImpl sm = (StateManagerImpl)row.getPrimaryKey();
if (sm != null) {
@ -167,18 +168,19 @@ public class PreparedStatementManagerImpl
* sql to select the key will be issued from DBDictionary.
*/
protected List populateAutoAssignCols(PreparedStatement stmnt,
Column[] autoAssign, RowImpl row)
Column[] autoAssign, String[] autoAssignColNames, RowImpl row)
throws SQLException {
List vals = null;
if (_dict.supportsGetGeneratedKeys) {
// set auto assign values to id col
vals = getGeneratedKeys(stmnt, autoAssign);
vals = getGeneratedKeys(stmnt, autoAssignColNames);
}
setObjectId(vals, autoAssign, row);
setObjectId(vals, autoAssign, autoAssignColNames, row);
return vals;
}
protected void setObjectId(List vals, Column[] autoAssign, RowImpl row)
protected void setObjectId(List vals, Column[] autoAssign,
String[] autoAssignColNames, RowImpl row)
throws SQLException{
OpenJPAStateManager sm = row.getPrimaryKey();
ClassMapping mapping = (ClassMapping) sm.getMetaData();
@ -201,12 +203,12 @@ public class PreparedStatementManagerImpl
* getGeneratedKeys.
*/
protected List getGeneratedKeys(PreparedStatement stmnt,
Column[] autoAssign)
String[] autoAssignColNames)
throws SQLException {
ResultSet rs = stmnt.getGeneratedKeys();
List<Object> vals = new ArrayList<Object>();
while (rs.next()) {
for (int i = 0; i < autoAssign.length; i++)
for (int i = 0; i < autoAssignColNames.length; i++)
vals.add(rs.getObject(i + 1));
}
rs.close();