OneToOneTest.testPkOneToOneSelectStatementDoesNotGenerateExtraJoin fails
on oracle and postresql
This commit is contained in:
Brett Meyer 2014-03-17 14:46:36 -04:00
parent f0af00b5a9
commit 548aa7c0de
1 changed files with 6 additions and 4 deletions

View File

@ -421,21 +421,23 @@ public class OneToOneTest extends BaseCoreFunctionalTestCase {
private static final long serialVersionUID = -3689681272273261051L; private static final long serialVersionUID = -3689681272273261051L;
private int expectedNumberOfJoins = 0; private int expectedNumberOfJoins = 0;
private String nextValString; private String nextValRegex;
public JoinCounter(int val) { public JoinCounter(int val) {
super(); super();
this.expectedNumberOfJoins = val; this.expectedNumberOfJoins = val;
try { try {
nextValString = getDialect().getSequenceNextValString(""); nextValRegex = ".*" + getDialect().getSelectSequenceNextValString(".*") + ".*";
nextValRegex = nextValRegex.replace( "(", "\\(" );
nextValRegex = nextValRegex.replace( ")", "\\)" );
} catch (MappingException ex) { } catch (MappingException ex) {
nextValString = "nextval"; nextValRegex = "nextval";
} }
} }
public String onPrepareStatement(String sql) { public String onPrepareStatement(String sql) {
int numberOfJoins = 0; int numberOfJoins = 0;
if (sql.startsWith("select") & !sql.contains(nextValString)) { if (sql.startsWith("select") & !sql.matches(nextValRegex)) {
numberOfJoins = count(sql, "join"); numberOfJoins = count(sql, "join");
assertEquals( sql, expectedNumberOfJoins, numberOfJoins ); assertEquals( sql, expectedNumberOfJoins, numberOfJoins );
} }