@Override public IPosition update(IPosition position) { PositionEntity entity; try { entity = getEntity(position); em.merge(entity); return new PositionProxy(entity); } catch (IllegalStateException e) { e.printStackTrace(); return null; } }
@Override public IPosition create(IPosition position) { try { PositionEntity entity = getEntity(position); em.persist(entity); entity.setReference(GenerateReferenceValue.genReference("P", entity.getId())); PositionEntity mergedPosition = em.merge(entity); return new PositionProxy(mergedPosition); } catch (IllegalStateException e) { e.printStackTrace(); return null; } }
@Override public IPosition delete(IPosition position) { PositionEntity entity; try { entity = getEntity(position); PositionEntity pos = em.find(PositionEntity.class, entity.getId()); if (pos != null) { em.remove(pos); } return null; } catch (IllegalStateException e) { e.printStackTrace(); return null; } }