HHH-7973 - Add test for issue

This commit is contained in:
Andrea Boriero 2016-02-09 15:23:53 +00:00
parent 500d74c35d
commit 9c75e79bc9
1 changed files with 27 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import javax.persistence.Table;
import org.hibernate.hql.internal.QuerySplitter;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.junit.Test;
@ -33,6 +34,32 @@ public class QuerySplitterTest extends BaseNonConfigCoreFunctionalTestCase {
);
}
@Test
@TestForIssue(jiraKey = "HHH-7973" )
public void testQueryWithEntityNameAsStringLiteral2() {
final String qry = "from Employee where name = 'He is the, Employee Number 1'";
String[] results = QuerySplitter.concreteQueries( qry, sessionFactory() );
assertEquals( 1, results.length );
assertEquals(
"from org.hibernate.test.hql.QuerySplitterTest$Employee where name = 'He is the, Employee Number 1'",
results[0]
);
}
@Test
@TestForIssue(jiraKey = "HHH-7973" )
public void testQueryWithEntityNameAsStringLiteralAndEscapeQuoteChar() {
final String qry = "from Employee where name = '''He is '' the, Employee Number 1'''";
String[] results = QuerySplitter.concreteQueries( qry, sessionFactory() );
assertEquals( 1, results.length );
assertEquals(
"from org.hibernate.test.hql.QuerySplitterTest$Employee where name = '''He is '' the, Employee Number 1'''",
results[0]
);
}
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Employee.class };