use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class OrderByTest method testOrderByWithDottedNotation.
@Test
@SkipForDialect(value = TeradataDialect.class, jiraKey = "HHH-8190", comment = "uses Teradata reserved word - summary")
public void testOrderByWithDottedNotation() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
BugSystem bs = new BugSystem();
HashSet<Bug> set = new HashSet<Bug>();
Bug bug = new Bug();
bug.setDescription("JPA-2 locking");
bug.setSummary("JPA-2 impl locking");
Person p = new Person();
p.setFirstName("Scott");
p.setLastName("Marlow");
bug.setReportedBy(p);
set.add(bug);
bug = new Bug();
bug.setDescription("JPA-2 annotations");
bug.setSummary("JPA-2 impl annotations");
p = new Person();
p.setFirstName("Emmanuel");
p.setLastName("Bernard");
bug.setReportedBy(p);
set.add(bug);
bug = new Bug();
bug.setDescription("Implement JPA-2 criteria");
bug.setSummary("JPA-2 impl criteria");
p = new Person();
p.setFirstName("Steve");
p.setLastName("Ebersole");
bug.setReportedBy(p);
set.add(bug);
bs.setBugs(set);
s.persist(bs);
tx.commit();
tx = s.beginTransaction();
s.clear();
bs = (BugSystem) s.get(BugSystem.class, bs.getId());
Assert.assertTrue("has three bugs", bs.getBugs().size() == 3);
Iterator iter = bs.getBugs().iterator();
Assert.assertEquals("Emmanuel", ((Bug) iter.next()).getReportedBy().getFirstName());
Assert.assertEquals("Steve", ((Bug) iter.next()).getReportedBy().getFirstName());
Assert.assertEquals("Scott", ((Bug) iter.next()).getReportedBy().getFirstName());
tx.commit();
s.close();
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class EnumeratedTypeTest method testTrimmedEnumChar.
@Test
@TestForIssue(jiraKey = "HHH-4699")
@SkipForDialect(value = { Oracle8iDialect.class, AbstractHANADialect.class }, jiraKey = "HHH-8516", comment = "HHH-4699 was specifically for using a CHAR, but Oracle/HANA do not handle the 2nd query correctly without VARCHAR. ")
public void testTrimmedEnumChar() throws SQLException {
// use native SQL to insert, forcing whitespace to occur
final Session s = openSession();
final Connection connection = ((SessionImplementor) s).connection();
final Statement statement = connection.createStatement();
statement.execute("insert into EntityEnum (id, trimmed) values(1, '" + Trimmed.A.name() + "')");
statement.execute("insert into EntityEnum (id, trimmed) values(2, '" + Trimmed.B.name() + "')");
s.getTransaction().begin();
// ensure EnumType can do #fromName with the trimming
List<EntityEnum> resultList = s.createQuery("select e from EntityEnum e").list();
assertEquals(resultList.size(), 2);
assertEquals(resultList.get(0).getTrimmed(), Trimmed.A);
assertEquals(resultList.get(1).getTrimmed(), Trimmed.B);
// ensure querying works
final Query query = s.createQuery("select e from EntityEnum e where e.trimmed=?");
query.setParameter(0, Trimmed.A);
resultList = query.list();
assertEquals(resultList.size(), 1);
assertEquals(resultList.get(0).getTrimmed(), Trimmed.A);
statement.execute("delete from EntityEnum");
s.getTransaction().commit();
s.close();
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class BasicHibernateAnnotationsTest method testVersioning.
@Test
@RequiresDialectFeature(DialectChecks.SupportsExpectedLobUsagePattern.class)
@SkipForDialect(value = TeradataDialect.class, comment = "One transaction hangs the other")
public void testVersioning() throws Exception {
Forest forest = new Forest();
forest.setName("Fontainebleau");
forest.setLength(33);
Session s;
Transaction tx;
s = openSession();
tx = s.beginTransaction();
s.persist(forest);
tx.commit();
s.close();
Session parallelSession = openSession();
Transaction parallelTx = parallelSession.beginTransaction();
s = openSession();
tx = s.beginTransaction();
forest = (Forest) parallelSession.get(Forest.class, forest.getId());
Forest reloadedForest = (Forest) s.get(Forest.class, forest.getId());
reloadedForest.setLength(11);
assertNotSame(forest, reloadedForest);
tx.commit();
s.close();
forest.setLength(22);
try {
parallelTx.commit();
fail("All optimistic locking should have make it fail");
} catch (OptimisticLockException e) {
if (parallelTx != null)
parallelTx.rollback();
} finally {
parallelSession.close();
}
s = openSession();
tx = s.beginTransaction();
s.delete(s.get(Forest.class, forest.getId()));
tx.commit();
s.close();
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class IndexedCollectionTest method testMapKeyOnManyToMany.
@Test
@SkipForDialect(value = TeradataDialect.class, jiraKey = "HHH-8190", comment = "uses Teradata reserved word - title")
public void testMapKeyOnManyToMany() throws Exception {
Session s;
s = openSession();
s.getTransaction().begin();
News airplane = new News();
airplane.setTitle("Crash!");
airplane.setDetail("An airplaned crashed.");
s.persist(airplane);
Newspaper lemonde = new Newspaper();
lemonde.setName("Lemonde");
lemonde.getNews().put(airplane.getTitle(), airplane);
s.persist(lemonde);
s.flush();
s.clear();
lemonde = (Newspaper) s.get(Newspaper.class, lemonde.getId());
assertEquals(1, lemonde.getNews().size());
News news = lemonde.getNews().get(airplane.getTitle());
assertNotNull(news);
assertEquals(airplane.getTitle(), news.getTitle());
s.delete(lemonde);
s.delete(news);
s.getTransaction().rollback();
s.close();
}
use of org.hibernate.testing.SkipForDialect in project hibernate-orm by hibernate.
the class ReferencedColumnNameTest method testUnidirectionalOneToMany.
@Test
@SkipForDialect(value = TeradataDialect.class, jiraKey = "HHH-8190", comment = "uses Teradata reserved word - type")
public void testUnidirectionalOneToMany() throws Exception {
Session s;
Transaction tx;
s = openSession();
tx = s.beginTransaction();
Clothes clothes = new Clothes("underwear", "interesting");
Luggage luggage = new Luggage("Emmanuel", "Cabin Luggage");
luggage.getHasInside().add(clothes);
s.persist(luggage);
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
luggage = (Luggage) s.createQuery("select l from Luggage l left join fetch l.hasInside").uniqueResult();
assertNotNull(luggage);
assertNotNull(luggage.getHasInside());
assertEquals(1, luggage.getHasInside().size());
s.delete(luggage.getHasInside().iterator().next());
s.delete(luggage);
tx.commit();
s.close();
}
Aggregations