Example #1
0
  @Override
  @Transactional
  public void persist(KeyValueEntity entity) {
    KeyValueBinaryVO bvo = new KeyValueBinaryVO();
    bvo.setUuid(entity.getUuid());
    try {
      bvo.setContents(SerializableHelper.writeObject(entity));
    } catch (IOException e) {
      throw new CloudRuntimeException(e);
    }
    dbf.getEntityManager().persist(bvo);

    List<KeyValueStruct> structs = new KeyValueSerializer().build(entity);
    for (KeyValueStruct struct : structs) {
      KeyValueVO vo = new KeyValueVO();
      vo.setClassName(entity.getClass().getName());
      vo.setUuid(entity.getUuid());
      vo.setEntityKey(struct.getKey());
      vo.setEntityValue(struct.getValue());
      vo.setValueType(struct.getType().getName());
      dbf.getEntityManager().persist(vo);
    }
  }
Example #2
0
 @Override
 public void delete(KeyValueEntity entity) {
   delete(entity.getUuid());
 }
Example #3
0
 @Override
 @Transactional
 public void update(KeyValueEntity entity) {
   delete(entity.getUuid());
   persist(entity);
 }