/** * Returns a shared copy of this IdProxy cleaned from a reference to entity. * <p>DO NOT use shared copies when assigning the same ID to another entity! * @see #copy(boolean) */ public IdProxy<T> copy() { return copy(true); }
@Override public IdProxy<K> getId() { if (idProxy == null) { idProxy = new IdProxy<>(this); } // return a copy cleaned from the reference to the entity return idProxy.copy(); }
@Override public void setId(IdProxy<K> idProxy) { this.idProxy = idProxy.copy(false); setDbGeneratedId(this.idProxy.get()); this.idProxy.setEntity(this); }