HHH-7973 - Add test for issue
This commit is contained in:
parent
3080d46a09
commit
c9631a9ae2
|
@ -12,6 +12,7 @@ import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.hql.internal.QuerySplitter;
|
import org.hibernate.hql.internal.QuerySplitter;
|
||||||
|
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||||
import org.junit.Test;
|
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
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
return new Class[] { Employee.class };
|
return new Class[] { Employee.class };
|
||||||
|
|
Loading…
Reference in New Issue