public Object copyDataStoreId(Object oid, ClassMetaData meta) { Id id = (Id) oid; return new Id(meta.getDescribedType(), id.getId(), id.hasSubclasses()); }
public Class<?> getManagedType(Object oid) { if (oid instanceof Id) return ((Id) oid).getType(); return null; }
public Object newDataStoreId(Object val, ClassMetaData meta) { return Id.newInstance(meta.getDescribedType(), val); }
/** * Create an id from the given type and value; the value might be an * id instance, a stringified id, or a primary key value. */ public static Id newInstance(Class cls, Object val) { if (val instanceof Id) return (Id) val; if (val instanceof String) return new Id(cls, (String) val); if (val instanceof Number) return new Id(cls, ((Number) val).longValue()); if (val == null) return new Id(cls, 0L); throw new UserException(_loc.get("unknown-oid", cls, val, val.getClass())); }
private Object[] getPKValues(OpenJPAStateManager sm, JDBCStore store) { Object[] pks = null; Object oid = sm.getObjectId(); if (_mapping.getIdentityType() == ClassMapping.ID_APPLICATION) pks = ApplicationIds.toPKValues(oid, _mapping); Object[] val = new Object[_pkCols.length]; int count = 0; for (int i = 0; i < _pkCols.length; i++, count++) { if (pks == null) val[0] = (oid == null) ? null : ((Id) oid).getId(); else { val[i] = _joins[i].getJoinValue(pks[_pkIndices[i]], _pkCols[i], store); } } return val; }
public Object getJoinValue(OpenJPAStateManager sm, Column col, JDBCStore store) { Id id = (Id) sm.getObjectId(); return (id == null) ? null : id.getIdObject(); }
/** * Create an id from the given type and value; the value might be an * id instnace, a stringified id, or a primary key value. */ public static Id newInstance(Class cls, Object val) { if (val instanceof Id) return (Id) val; if (val instanceof String) return new Id(cls, (String) val); if (val instanceof Number) return new Id(cls, ((Number) val).longValue()); if (val == null) return new Id(cls, 0L); throw new UserException(_loc.get("unknown-oid", cls, val, val.getClass())); }
private Object[] getPKValues(OpenJPAStateManager sm, JDBCStore store) { Object[] pks = null; Object oid = sm.getObjectId(); if (_mapping.getIdentityType() == ClassMapping.ID_APPLICATION) pks = ApplicationIds.toPKValues(oid, _mapping); Object[] val = new Object[_pkCols.length]; int count = 0; for (int i = 0; i < _pkCols.length; i++, count++) { if (pks == null) val[0] = (oid == null) ? null : ((Id) oid).getId(); else { val[i] = _joins[i].getJoinValue(pks[_pkIndices[i]], _pkCols[i], store); } } return val; }
public Object getJoinValue(OpenJPAStateManager sm, Column col, JDBCStore store) { Id id = (Id) sm.getObjectId(); return (id == null) ? null : id.getIdObject(); }
public Object copyDataStoreId(Object oid, ClassMetaData meta) { Id id = (Id) oid; return new Id(meta.getDescribedType(), id.getId(), id.hasSubclasses()); }
/** * Create an id from the given type and value; the value might be an * id instance, a stringified id, or a primary key value. */ public static Id newInstance(Class cls, Object val) { if (val instanceof Id) return (Id) val; if (val instanceof String) return new Id(cls, (String) val); if (val instanceof Number) return new Id(cls, ((Number) val).longValue()); if (val == null) return new Id(cls, 0L); throw new UserException(_loc.get("unknown-oid", cls, val, val.getClass())); }
private Object[] getPKValues(OpenJPAStateManager sm, JDBCStore store) { Object[] pks = null; Object oid = sm.getObjectId(); if (_mapping.getIdentityType() == ClassMapping.ID_APPLICATION) pks = ApplicationIds.toPKValues(oid, _mapping); Object[] val = new Object[_pkCols.length]; int count = 0; for (int i = 0; i < _pkCols.length; i++, count++) { if (pks == null) val[0] = (oid == null) ? null : ((Id) oid).getId(); else { val[i] = _joins[i].getJoinValue(pks[_pkIndices[i]], _pkCols[i], store); } } return val; }
public Class getManagedType(Object oid) { if (oid instanceof Id) return ((Id) oid).getType(); return null; }
public Object newDataStoreId(Object val, ClassMetaData meta) { return Id.newInstance(meta.getDescribedType(), val); }
public Object getJoinValue(OpenJPAStateManager sm, Column col, JDBCStore store) { Id id = (Id) sm.getObjectId(); return (id == null) ? null : id.getIdObject(); }
public Object copyDataStoreId(Object oid, ClassMetaData meta) { Id id = (Id) oid; return new Id(meta.getDescribedType(), id.getId(), id.hasSubclasses()); }
/** * Create an id from the given type and value; the value might be an * id instance, a stringified id, or a primary key value. */ public static Id newInstance(Class cls, Object val) { if (val instanceof Id) return (Id) val; if (val instanceof String) return new Id(cls, (String) val); if (val instanceof Number) return new Id(cls, ((Number) val).longValue()); if (val == null) return new Id(cls, 0L); throw new UserException(_loc.get("unknown-oid", cls, val, val.getClass())); }
private Object[] getPKValues(OpenJPAStateManager sm, JDBCStore store) { Object[] pks = null; Object oid = sm.getObjectId(); if (_mapping.getIdentityType() == ClassMapping.ID_APPLICATION) pks = ApplicationIds.toPKValues(oid, _mapping); Object[] val = new Object[_pkCols.length]; int count = 0; for (int i = 0; i < _pkCols.length; i++, count++) { if (pks == null) val[0] = (oid == null) ? null : ((Id) oid).getId(); else { val[i] = _joins[i].getJoinValue(pks[_pkIndices[i]], _pkCols[i], store); } } return val; }
public Class<?> getManagedType(Object oid) { if (oid instanceof Id) return ((Id) oid).getType(); return null; }
public Object newDataStoreId(Object val, ClassMetaData meta) { return Id.newInstance(meta.getDescribedType(), val); }