mirror of https://github.com/apache/openjpa.git
OPENJPA-423
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@589694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da5d28cb1a
commit
c5ff10a141
|
@ -461,8 +461,9 @@ public class TableJDBCSeq
|
||||||
String tableName = resolveTableName(mapping, _seqColumn.getTable());
|
String tableName = resolveTableName(mapping, _seqColumn.getTable());
|
||||||
SQLBuffer tables = new SQLBuffer(dict).append(tableName);
|
SQLBuffer tables = new SQLBuffer(dict).append(tableName);
|
||||||
|
|
||||||
SQLBuffer select = dict.toSelect(sel, null, tables, where, null,
|
SQLBuffer select = dict.toSelect(sel, null, tables, where, null, null,
|
||||||
null, null, false, dict.supportsSelectForUpdate, 0, Long.MAX_VALUE);
|
null, false, dict.supportsSelectForUpdate, 0, Long.MAX_VALUE,
|
||||||
|
false, true);
|
||||||
|
|
||||||
PreparedStatement stmnt = select.prepareStatement(conn);
|
PreparedStatement stmnt = select.prepareStatement(conn);
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
|
|
@ -2186,7 +2186,7 @@ public class DBDictionary
|
||||||
/**
|
/**
|
||||||
* Combine the given components into a SELECT statement.
|
* 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 from, SQLBuffer where, SQLBuffer group,
|
||||||
SQLBuffer having, SQLBuffer order,
|
SQLBuffer having, SQLBuffer order,
|
||||||
boolean distinct, boolean forUpdate, long start, long end,
|
boolean distinct, boolean forUpdate, long start, long end,
|
||||||
|
@ -2195,6 +2195,16 @@ public class DBDictionary
|
||||||
group, having, order, distinct, start, end,
|
group, having, order, distinct, start, end,
|
||||||
getForUpdateClause(fetch, forUpdate, null), subselect);
|
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.
|
* Combine the given components into a SELECT statement.
|
||||||
|
@ -2236,13 +2246,24 @@ public class DBDictionary
|
||||||
/**
|
/**
|
||||||
* Return the SQL for the given selecting operation.
|
* 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 from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
||||||
SQLBuffer order, boolean distinct, long start, long end,
|
SQLBuffer order, boolean distinct, long start, long end,
|
||||||
String forUpdateClause) {
|
String forUpdateClause) {
|
||||||
return toOperation(op, selects, from, where, group, having, order,
|
return toOperation(op, selects, from, where, group, having, order,
|
||||||
distinct, start, end, forUpdateClause, false);
|
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.
|
* Return the SQL for the given selecting operation.
|
||||||
|
@ -2250,7 +2271,7 @@ public class DBDictionary
|
||||||
private SQLBuffer toOperation(String op, SQLBuffer selects,
|
private SQLBuffer toOperation(String op, SQLBuffer selects,
|
||||||
SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
||||||
SQLBuffer order, boolean distinct, long start, long end,
|
SQLBuffer order, boolean distinct, long start, long end,
|
||||||
String forUpdateClause, boolean subselect) {
|
String forUpdateClause, boolean subselect, boolean checkTableForUpdate) {
|
||||||
SQLBuffer buf = new SQLBuffer(this);
|
SQLBuffer buf = new SQLBuffer(this);
|
||||||
buf.append(op);
|
buf.append(op);
|
||||||
|
|
||||||
|
@ -2264,6 +2285,12 @@ public class DBDictionary
|
||||||
|
|
||||||
buf.append(" ").append(selects).append(" FROM ").append(from);
|
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())
|
if (where != null && !where.isEmpty())
|
||||||
buf.append(" WHERE ").append(where);
|
buf.append(" WHERE ").append(where);
|
||||||
if (group != null && !group.isEmpty())
|
if (group != null && !group.isEmpty())
|
||||||
|
|
|
@ -193,7 +193,7 @@ public class HSQLDictionary
|
||||||
return buf.toString();
|
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 from, SQLBuffer where, SQLBuffer group, SQLBuffer having,
|
||||||
SQLBuffer order, boolean distinct, long start, long end,
|
SQLBuffer order, boolean distinct, long start, long end,
|
||||||
String forUpdateClause) {
|
String forUpdateClause) {
|
||||||
|
|
Loading…
Reference in New Issue