VM-Core/src/main/java/com/validation/manager/core/server/core/VMIdServer.java
@Override
    public int write2DB() throws VMException {
        try {
            VmIdJpaController controller = new VmIdJpaController(
                    getEntityManagerFactory());
            VmId vmId;
            if (getId() == null) {
                vmId = new VmId();
                update(vmId, this);
                controller.create(vmId);
                setId(vmId.getId());
            } else {
                vmId = getEntity();
                update(vmId, this);
                controller.edit(vmId);
            }
            update();
            return getId();
        }
        catch (Exception ex) {
            LOG.log(Level.SEVERE, null, ex);
            throw new VMException(ex);
        }
    }
@Override
    public int write2DB() throws VMException {
        try {
            VmIdJpaController controller = new VmIdJpaController(
                    getEntityManagerFactory());
            VmId vmId;
            if (getId() == null) {
                vmId = new VmId();
                update(vmId, this);
                controller.create(vmId);
                setId(vmId.getId());
            } else {
                vmId = getEntity();
                update(vmId, this);
                controller.edit(vmId);
            }
            update();
            return getId();
        }
        catch (Exception ex) {
            LOG.log(Level.SEVERE, null, ex);
            throw new VMException(ex);
        }
    }
write to db