1 | public void testBoundedMaterializedBlobAccess() {↵ | | 1 | public void testBoundedMaterializedClobAccess() {↵
|
2 | byte[] original = buildRecursively( BLOB_SIZE, true );↵ | | 2 | String original = buildRecursively( CLOB_SIZE, 'x' );↵
|
3 | byte[] changed = buildRecursively( BLOB_SIZE, false );↵ | | 3 | String changed = buildRecursively( CLOB_SIZE, 'y' );↵
|
|
4 | Session s = openSession();↵ | | 4 | Session s = openSession();↵
|
5 | s.beginTransaction();↵ | | 5 | s.beginTransaction();↵
|
6 | LobHolder entity = new LobHolder();↵ | | 6 | LobHolder entity = new LobHolder();↵
|
7 | entity.setMaterializedBlob( original );↵ | | 7 | entity.setMaterializedClob( original );↵
|
8 | s.save( entity );↵ | | 8 | s.save( entity );↵
|
9 | s.getTransaction().commit();↵ | | 9 | s.getTransaction().commit();↵
|
10 | s.close();↵ | | 10 | s.close();↵
|
|
11 | s = openSession();↵ | | 11 | s = openSession();↵
|
12 | s.beginTransaction();↵ | | 12 | s.beginTransaction();↵
|
13 | entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );↵ | | 13 | entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );↵
|
14 | assertEquals( BLOB_SIZE, entity.getMaterializedBlob().length );↵ | | 14 | assertEquals( CLOB_SIZE, entity.getMaterializedClob().length() );↵
|
15 | assertEquals( original, entity.getMaterializedBlob() );↵ | | 15 | assertEquals( original, entity.getMaterializedClob() );↵
|
16 | entity.setMaterializedBlob( changed );↵ | | 16 | entity.setMaterializedClob( changed );↵
|
17 | s.getTransaction().commit();↵ | | 17 | s.getTransaction().commit();↵
|
18 | s.close();↵ | | 18 | s.close();↵
|
|
19 | s = openSession();↵ | | 19 | s = openSession();↵
|
20 | s.beginTransaction();↵ | | 20 | s.beginTransaction();↵
|
21 | entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );↵ | | 21 | entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );↵
|
22 | assertEquals( BLOB_SIZE, entity.getMaterializedBlob().length );↵ | | 22 | assertEquals( CLOB_SIZE, entity.getMaterializedClob().length() );↵
|
23 | assertEquals( changed, entity.getMaterializedBlob() );↵ | | 23 | assertEquals( changed, entity.getMaterializedClob() );↵
|
24 | s.delete( entity );↵ | | 24 | s.delete( entity );↵
|
25 | s.getTransaction().commit();↵ | | 25 | s.getTransaction().commit();↵
|
26 | s.close();↵ | | 26 | s.close();↵
|
27 | | | 27 |
|