Code example for Session

Methods: closeflushgetLobHelperrefreshsavebeginTransactiongetTransaction

0
		// Sybase does not support ResultSet.getBlob(String) 
		if ( getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect ) {
			return; 
		} 
		Session s = openSession();
		s.beginTransaction();
		Blobber b = new Blobber();
		b.setBlob( s.getLobHelper().createBlob( "foo/bar/baz".getBytes() ) );
		b.setClob( s.getLobHelper().createClob("foo/bar/baz") );
		s.save(b);
		//s.refresh(b); 
		//assertTrue( b.getClob() instanceof ClobImpl ); 
		s.flush();
 
		s.refresh(b);
		//b.getBlob().setBytes( 2, "abc".getBytes() ); 
		b.getClob().getSubString(2, 3);
		//b.getClob().setString(2, "abc"); 
		s.flush();
		s.getTransaction().commit();
		s.close();
 
		s = openSession();
		s.beginTransaction();
		b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
		Blobber b2 = new Blobber();
Contextual code suggestions in your IDE  Get Codota for Java