@Test
  public void testBoundedLongByteArrayAccess() {
    byte[] original = buildRecursively(ARRAY_SIZE, true);
    byte[] changed = buildRecursively(ARRAY_SIZE, false);
    byte[] empty = new byte[] {};

    Session s = openSession();
    s.beginTransaction();
    LongByteArrayHolder entity = new LongByteArrayHolder();
    s.save(entity);
    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    entity = (LongByteArrayHolder) s.get(LongByteArrayHolder.class, entity.getId());
    assertNull(entity.getLongByteArray());
    entity.setLongByteArray(original);
    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    entity = (LongByteArrayHolder) s.get(LongByteArrayHolder.class, entity.getId());
    Assert.assertEquals(ARRAY_SIZE, entity.getLongByteArray().length);
    assertEquals(original, entity.getLongByteArray());
    entity.setLongByteArray(changed);
    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    entity = (LongByteArrayHolder) s.get(LongByteArrayHolder.class, entity.getId());
    Assert.assertEquals(ARRAY_SIZE, entity.getLongByteArray().length);
    assertEquals(changed, entity.getLongByteArray());
    entity.setLongByteArray(null);
    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    entity = (LongByteArrayHolder) s.get(LongByteArrayHolder.class, entity.getId());
    assertNull(entity.getLongByteArray());
    entity.setLongByteArray(empty);
    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    entity = (LongByteArrayHolder) s.get(LongByteArrayHolder.class, entity.getId());
    if (entity.getLongByteArray() != null) {
      Assert.assertEquals(empty.length, entity.getLongByteArray().length);
      assertEquals(empty, entity.getLongByteArray());
    }
    s.delete(entity);
    s.getTransaction().commit();
    s.close();
  }
  @Test
  public void testSaving() {
    byte[] value = buildRecursively(ARRAY_SIZE, true);

    Session s = openSession();
    s.beginTransaction();
    LongByteArrayHolder entity = new LongByteArrayHolder();
    entity.setLongByteArray(value);
    s.persist(entity);
    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    entity = (LongByteArrayHolder) s.get(LongByteArrayHolder.class, entity.getId());
    Assert.assertEquals(ARRAY_SIZE, entity.getLongByteArray().length);
    assertEquals(value, entity.getLongByteArray());
    s.delete(entity);
    s.getTransaction().commit();
    s.close();
  }