/** * Translate from a OpenJPA identity object to a Persistence one. */ public static Object fromOpenJPAObjectId(Object oid) { if (oid instanceof OpenJPAId) return ((OpenJPAId) oid).getIdObject(); return oid; }
/** * Translate from a OpenJPA identity object to a Persistence one. */ public static Object fromOpenJPAObjectId(Object oid) { if (oid instanceof OpenJPAId) return ((OpenJPAId) oid).getIdObject(); return oid; }
/** * Translate from a OpenJPA identity object to a Persistence one. */ public static Object fromOpenJPAObjectId(Object oid) { if (oid instanceof OpenJPAId) return ((OpenJPAId) oid).getIdObject(); return oid; }
/** * Translate from a OpenJPA identity object to a Persistence one. */ public static Object fromOpenJPAObjectId(Object oid) { if (oid instanceof OpenJPAId) return ((OpenJPAId) oid).getIdObject(); return oid; }
/** * Translate from a OpenJPA identity object to a Persistence one. */ public static Object fromOpenJPAObjectId(Object oid) { if (oid instanceof OpenJPAId) return ((OpenJPAId) oid).getIdObject(); return oid; }
public int compareTo(Object other) { if (other == this) return 0; if (other == null) return 1; return ((Comparable) getIdObject()).compareTo(((OpenJPAId) other).getIdObject ()); } }
public int compareTo(Object other) { if (other == this) return 0; if (other == null) return 1; return ((Comparable) getIdObject()).compareTo(((OpenJPAId) other). getIdObject ()); } }
public int compareTo(Object other) { if (other == this) return 0; if (other == null) return 1; return ((Comparable) getIdObject()).compareTo(((OpenJPAId) other).getIdObject ()); } }
public int compareTo(Object other) { if (other == this) return 0; if (other == null) return 1; return ((Comparable) getIdObject()).compareTo(((OpenJPAId) other).getIdObject ()); } }
public int compareTo(Object other) { if (other == this) return 0; if (other == null) return 1; return ((Comparable) getIdObject()).compareTo(((OpenJPAId) other).getIdObject ()); } }
public String toString() { return type.getName() + TYPE_VALUE_SEP + getIdObject(); }
public String toString() { return type.getName() + TYPE_VALUE_SEP + getIdObject(); }
public String toString() { return type.getName() + TYPE_VALUE_SEP + getIdObject(); }
public String toString() { return type.getName() + TYPE_VALUE_SEP + getIdObject(); }
public String toString() { return type.getName() + "-" + getIdObject(); }
@Override public ByteBuffer toByteBuffer(Object oid) { Object id = ((OpenJPAId)oid).getIdObject(); return idSerializer.toByteBuffer(id); }
private void delete(OpenJPAId oid, CompassSession session) { Class cls = oid.getType(); Object id = oid.getIdObject(); session.delete(cls, id); }
@Override public ByteBuffer toByteBuffer(Object oid) { return dynamicSerializer.toByteBuffer(createComposite(((OpenJPAId) oid) .getIdObject())); }
@SuppressWarnings({"unchecked"}) private void reindexOid(OpenJPAId oid, OpenJPAEntityManager em, CompassSession session) { try { Object o = em.find(oid.getType(), oid.getIdObject()); reindex(o, session); } catch (EntityNotFoundException e) { delete(oid, session); } }
/** * Return the given primary key field value from the given oid. */ public static Object get(Object oid, FieldMetaData fmd) { if (oid == null) return null; if (oid instanceof OpenJPAId) return ((OpenJPAId) oid).getIdObject(); ClassMetaData meta = fmd.getDefiningMetaData(); Class<?> oidType = oid.getClass(); if (AccessCode.isField(meta.getAccessType())) return Reflection.get(oid, Reflection.findField(oidType, fmd.getName(), true)); return Reflection.get(oid, Reflection.findGetter(oidType, fmd.getName(), true)); }