use of org.hibernate.dialect.MySQLDialect in project hibernate-orm by hibernate.
the class FumTest method testCompositeKeyPathExpressions.
@Test
@SkipForDialect(value = SybaseASE15Dialect.class, jiraKey = "HHH-3690")
public void testCompositeKeyPathExpressions() throws Exception {
Session s = openSession();
s.beginTransaction();
s.createQuery("select fum1.fo from Fum fum1 where fum1.fo.fum is not null").list();
s.createQuery("from Fum fum1 where fum1.fo.fum is not null order by fum1.fo.fum").list();
if (!(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof PointbaseDialect)) {
s.createQuery("from Fum fum1 where exists elements(fum1.friends)").list();
if (!(getDialect() instanceof TimesTenDialect)) {
// can't execute because TimesTen can't do subqueries combined with aggreations
s.createQuery("from Fum fum1 where size(fum1.friends) = 0").list();
}
}
s.createQuery("select elements(fum1.friends) from Fum fum1").list();
s.createQuery("from Fum fum1, fr in elements( fum1.friends )").list();
s.getTransaction().commit();
s.close();
}
use of org.hibernate.dialect.MySQLDialect in project hibernate-orm by hibernate.
the class LikeTest method testLike.
@Test
public void testLike() {
Session session = openSession();
Transaction tx = session.beginTransaction();
TestObject obj = new TestObject();
String uniq = "uniq" + System.currentTimeMillis();
obj.setText("XyZ " + uniq + " blablabla");
session.save(obj);
session.flush();
tx.commit();
session.close();
String pattern = "XyZ " + uniq + "%";
// retrieve object - case sensitive - works ok
session = openSession();
tx = session.beginTransaction();
List objects = session.createCriteria(TestObject.class).add(Restrictions.like("text", pattern)).list();
assertEquals(1, objects.size());
session.clear();
// retrieve object - case insensitive - works ok
objects = session.createCriteria(TestObject.class).add(Restrictions.like("text", pattern).ignoreCase()).list();
assertEquals(1, objects.size());
session.clear();
if (!(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof PostgreSQLDialect) && !(getDialect() instanceof PostgreSQL81Dialect)) {
// retrieve object - case insensitive via custom expression - works
// ok
objects = session.createCriteria(TestObject.class).add(StringExpression.stringExpression("text", pattern, true)).list();
assertEquals(1, objects.size());
session.clear();
// retrieve object - case sensitive via custom expression - not
// working
objects = session.createCriteria(TestObject.class).add(StringExpression.stringExpression("text", pattern, false)).list();
assertEquals(1, objects.size());
}
tx.rollback();
session.close();
}
Aggregations