use of org.hibernate.test.sql.hand.TextHolder in project hibernate-orm by hibernate.
the class CustomSQLTestSupport method testTextProperty.
@Test
public void testTextProperty() {
Session s = openSession();
Transaction t = s.beginTransaction();
String description = buildLongString(15000, 'a');
TextHolder holder = new TextHolder(description);
s.save(holder);
t.commit();
s.close();
s = openSession();
t = s.beginTransaction();
holder = (TextHolder) s.get(TextHolder.class, holder.getId());
assertEquals(description, holder.getDescription());
description = buildLongString(15000, 'b');
holder.setDescription(description);
s.save(holder);
t.commit();
s.close();
s = openSession();
t = s.beginTransaction();
holder = (TextHolder) s.get(TextHolder.class, holder.getId());
assertEquals(description, holder.getDescription());
s.delete(holder);
t.commit();
s.close();
}
use of org.hibernate.test.sql.hand.TextHolder in project hibernate-orm by hibernate.
the class NativeSQLQueriesTest method testTextTypeInSQLQuery.
@SkipForDialect(value = AbstractHANADialect.class, comment = "On HANA, this returns an clob for the text column which doesn't get mapped to a String")
@Test
public void testTextTypeInSQLQuery() {
Session s = openSession();
Transaction t = s.beginTransaction();
String description = buildLongString(15000, 'a');
TextHolder holder = new TextHolder(description);
s.persist(holder);
t.commit();
s.close();
s = openSession();
t = s.beginTransaction();
String descriptionRead = (String) s.createSQLQuery(getDescriptionsSQL()).uniqueResult();
assertEquals(description, descriptionRead);
s.delete(holder);
t.commit();
s.close();
}
Aggregations