/** * Check if the persistence unit default <cascade-persist> has been enabled. If so, then change * CASCADE_NONE to CASCADE_IMMEDIATE. */ private int checkPUDefaultCascadePersist() { if (_checkPUDefaultCascadePersist) { // Apply default <cascade-persist> only to entity relationships boolean applyDefaultCascadePersist = false; switch (_owner.getAssociationType()) { case FieldMetaData.ONE_TO_ONE: case FieldMetaData.ONE_TO_MANY: case FieldMetaData.MANY_TO_MANY: case FieldMetaData.MANY_TO_ONE: applyDefaultCascadePersist = true; default: } if (applyDefaultCascadePersist) { Boolean dcpe = getRepository().getMetaDataFactory().getDefaults().isDefaultCascadePersistEnabled(); if (dcpe != null && dcpe.equals(Boolean.TRUE) && _persist == CASCADE_NONE) { _persist = CASCADE_IMMEDIATE; } } _checkPUDefaultCascadePersist = false; } return _persist; }
/** * Check if the persistence unit default <cascade-persist> has been enabled. If so, then change * CASCADE_NONE to CASCADE_IMMEDIATE. */ private int checkPUDefaultCascadePersist() { if (_checkPUDefaultCascadePersist) { // Apply default <cascade-persist> only to entity relationships boolean applyDefaultCascadePersist = false; switch (_owner.getAssociationType()) { case FieldMetaData.ONE_TO_ONE: case FieldMetaData.ONE_TO_MANY: case FieldMetaData.MANY_TO_MANY: case FieldMetaData.MANY_TO_ONE: applyDefaultCascadePersist = true; default: } if (applyDefaultCascadePersist) { Boolean dcpe = getRepository().getMetaDataFactory().getDefaults().isDefaultCascadePersistEnabled(); if (dcpe != null && dcpe.equals(Boolean.TRUE) && _persist == CASCADE_NONE) { _persist = CASCADE_IMMEDIATE; } } _checkPUDefaultCascadePersist = false; } return _persist; }
public String getValueMappedBy() { if (_mappedBy == MAPPED_BY_PK) { // use this instead of getting meta from element b/c that // requires element to be resolved ClassMetaData meta = getRepository().getMetaData (_owner.getElement().getType(), null, false); if (meta == null) throw new MetaDataException(_loc.get("val-not-pc", _owner)); if (meta.getPrimaryKeyFields().length != 1) throw new MetaDataException(_loc.get("val-not-one-pk", _owner)); _mappedByMeta = meta.getPrimaryKeyFields()[0]; _mappedBy = _mappedByMeta.getName(); } return _mappedBy; }
public String getValueMappedBy() { if (_mappedBy == MAPPED_BY_PK) { // use this instead of getting meta from element b/c that // requires element to be resolved ClassMetaData meta = getRepository().getMetaData (_owner.getElement().getType(), null, false); if (meta == null) throw new MetaDataException(_loc.get("val-not-pc", _owner)); if (meta.getPrimaryKeyFields().length != 1) throw new MetaDataException(_loc.get("val-not-one-pk", _owner)); _mappedByMeta = meta.getPrimaryKeyFields()[0]; _mappedBy = _mappedByMeta.getName(); } return _mappedBy; }
public String getValueMappedBy() { if (_mappedBy == MAPPED_BY_PK) { // use this instead of getting meta from element b/c that // requires element to be resolved ClassMetaData meta = getRepository().getMetaData (_owner.getElement().getType(), null, false); if (meta == null) throw new MetaDataException(_loc.get("val-not-pc", _owner)); if (meta.getPrimaryKeyFields().length != 1) throw new MetaDataException(_loc.get("val-not-one-pk", _owner)); _mappedByMeta = meta.getPrimaryKeyFields()[0]; _mappedBy = _mappedByMeta.getName(); } return _mappedBy; }
public String getValueMappedBy() { if (_mappedBy == MAPPED_BY_PK) { // use this instead of getting meta from element b/c that // requires element to be resolved ClassMetaData meta = getRepository().getMetaData (_owner.getElement().getType(), null, false); if (meta == null) throw new MetaDataException(_loc.get("val-not-pc", _owner)); if (meta.getPrimaryKeyFields().length != 1) throw new MetaDataException(_loc.get("val-not-one-pk", _owner)); _mappedByMeta = meta.getPrimaryKeyFields()[0]; _mappedBy = _mappedByMeta.getName(); } return _mappedBy; }
public String getValueMappedBy() { if (_mappedBy == MAPPED_BY_PK) { // use this instead of getting meta from element b/c that // requires element to be resolved ClassMetaData meta = getRepository().getMetaData (_owner.getElement().getType(), null, false); if (meta == null) throw new MetaDataException(_loc.get("val-not-pc", _owner)); if (meta.getPrimaryKeyFields().length != 1) throw new MetaDataException(_loc.get("val-not-one-pk", _owner)); _mappedByMeta = meta.getPrimaryKeyFields()[0]; _mappedBy = _mappedByMeta.getName(); } return _mappedBy; }