Map<String, byte[]> byteCollection = new HashMap<String, byte[]>();
ObjectAccessor accessor = new ObjectAccessor();
accessor.toBytes(10);
byteCollection.put("key1", accessor.toBytes(10));
byteCollection.put("key2", accessor.toBytes(11));
EntityWithCollection entity = new EntityWithCollection();
entity.setId("entityId1");
entity.setDataMap(byteCollection);
em.persist(entity); // persist entity.