OneToOneTest.testPkOneToOneSelectStatementDoesNotGenerateExtraJoin fails
on oracle and postresql
This commit is contained in:
Brett Meyer 2014-03-17 14:46:36 -04:00
parent 7b349a2be8
commit 514f096061
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 int expectedNumberOfJoins = 0;
private String nextValString;
private String nextValRegex;
public JoinCounter(int val) {
super();
this.expectedNumberOfJoins = val;
try {
nextValString = getDialect().getSequenceNextValString("");
nextValRegex = ".*" + getDialect().getSelectSequenceNextValString(".*") + ".*";
nextValRegex = nextValRegex.replace( "(", "\\(" );
nextValRegex = nextValRegex.replace( ")", "\\)" );
} catch (MappingException ex) {
nextValString = "nextval";
nextValRegex = "nextval";
}
}
public String onPrepareStatement(String sql) {
int numberOfJoins = 0;
if (sql.startsWith("select") & !sql.contains(nextValString)) {
if (sql.startsWith("select") & !sql.matches(nextValRegex)) {
numberOfJoins = count(sql, "join");
assertEquals( sql, expectedNumberOfJoins, numberOfJoins );
}