mirror of https://github.com/apache/openjpa.git
OPENJPA-423
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@589696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f92ab5842
commit
80d2c39020
|
@ -461,8 +461,9 @@ public class TableJDBCSeq
|
|||
String tableName = resolveTableName(mapping, _seqColumn.getTable());
|
||||
SQLBuffer tables = new SQLBuffer(dict).append(tableName);
|
||||
|
||||
SQLBuffer select = dict.toSelect(sel, null, tables, where, null,
|
||||
null, null, false, dict.supportsSelectForUpdate, 0, Long.MAX_VALUE);
|
||||
SQLBuffer select = dict.toSelect(sel, null, tables, where, null, null,
|
||||
null, false, dict.supportsSelectForUpdate, 0, Long.MAX_VALUE,
|
||||
false, true);
|
||||
|
||||
PreparedStatement stmnt = select.prepareStatement(conn);
|
||||
ResultSet rs = null;
|
||||
|
|
|
@ -2192,7 +2192,7 @@ public class DBDictionary
|
|||
/**
|
||||
* Combine the given components into a SELECT statement.
|
||||
*/
|
||||
private SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch,
|
||||
public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch,
|
||||
SQLBuffer from, SQLBuffer where, SQLBuffer group,
|
||||
SQLBuffer having, SQLBuffer order,
|
||||
boolean distinct, boolean forUpdate, long start, long end,
|
||||
|
@ -2201,6 +2201,16 @@ public class DBDictionary
|
|||
group, having, order, distinct, start, end,
|
||||
getForUpdateClause(fetch, forUpdate, null), subselect);
|
||||
}
|
||||
|
||||
public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch,
|
||||
SQLBuffer from, SQLBuffer where, SQLBuffer group,
|
||||
SQLBuffer having, SQLBuffer order,
|
||||
boolean distinct, boolean forUpdate, long start, long end,
|
||||
boolean subselect, boolean checkTableForUpdate) {
|
||||
return toOperation(getSelectOperation(fetch), selects, from, where,
|
||||
group, having, order, distinct, start, end,
|
||||
getForUpdateClause(fetch, forUpdate, null), subselect, checkTableForUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine the given components into a SELECT statement.
|
||||
|
@ -2242,13 +2252,24 @@ public class DBDictionary
|
|||
/**
|
||||
* Return the SQL for the given selecting operation.
|
||||
*/
|
||||
protected SQLBuffer toOperation(String op, SQLBuffer selects,
|
||||
public SQLBuffer toOperation(String op, SQLBuffer selects,
|
||||
SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
||||
SQLBuffer order, boolean distinct, long start, long end,
|
||||
String forUpdateClause) {
|
||||
return toOperation(op, selects, from, where, group, having, order,
|
||||
distinct, start, end, forUpdateClause, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SQL for the given selecting operation.
|
||||
*/
|
||||
public SQLBuffer toOperation(String op, SQLBuffer selects,
|
||||
SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
||||
SQLBuffer order, boolean distinct, long start, long end,
|
||||
String forUpdateClause, boolean subselect) {
|
||||
return toOperation(op, selects, from, where, group, having, order,
|
||||
distinct, start, end, forUpdateClause, subselect, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SQL for the given selecting operation.
|
||||
|
@ -2256,7 +2277,7 @@ public class DBDictionary
|
|||
private SQLBuffer toOperation(String op, SQLBuffer selects,
|
||||
SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
||||
SQLBuffer order, boolean distinct, long start, long end,
|
||||
String forUpdateClause, boolean subselect) {
|
||||
String forUpdateClause, boolean subselect, boolean checkTableForUpdate) {
|
||||
SQLBuffer buf = new SQLBuffer(this);
|
||||
buf.append(op);
|
||||
|
||||
|
@ -2270,6 +2291,12 @@ public class DBDictionary
|
|||
|
||||
buf.append(" ").append(selects).append(" FROM ").append(from);
|
||||
|
||||
if (checkTableForUpdate
|
||||
&& (StringUtils.isEmpty(forUpdateClause) && !StringUtils
|
||||
.isEmpty(tableForUpdateClause))) {
|
||||
buf.append(" ").append(tableForUpdateClause);
|
||||
}
|
||||
|
||||
if (where != null && !where.isEmpty())
|
||||
buf.append(" WHERE ").append(where);
|
||||
if (group != null && !group.isEmpty())
|
||||
|
|
|
@ -193,7 +193,7 @@ public class HSQLDictionary
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
protected SQLBuffer toOperation(String op, SQLBuffer selects,
|
||||
public SQLBuffer toOperation(String op, SQLBuffer selects,
|
||||
SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
||||
SQLBuffer order, boolean distinct, long start, long end,
|
||||
String forUpdateClause) {
|
||||
|
|
Loading…
Reference in New Issue