Code example for Session

Methods: closesavebeginTransaction

0
	@Test
	@TestForIssue( jiraKey = "HHH-3694" ) 
	public void testResultTransformerIsAppliedToScrollableResults() throws ExceptionSession s = openSession();
		Transaction tx = s.beginTransaction();
 
		PartnerA a = new PartnerA();
		a.setName("Partner A");
		PartnerB b = new PartnerB();
		b.setName("Partner B");
		Contract obj1 = new Contract();
		obj1.setName("Contract");
		obj1.setA(a);
		obj1.setB(b);
		s.save(a);
		s.save(b);
		s.save(obj1);
 
		tx.commit();
		s.close();
 
		s = openSession();
 
		Query q = s.getNamedQuery(Contract.class.getName() + ".testQuery");
		q.setFetchSize(100);
Stop searching for code, let great code find you!  Add Codota to your java IDE