Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.Id


    public Object newDataStoreId(Object val, ClassMetaData meta) {
        return Id.newInstance(meta.getDescribedType(), val);
    }

    public Id newDataStoreId(long id, ClassMapping mapping, boolean subs) {
        return new Id(mapping.getDescribedType(), id, subs);
    }
View Full Code Here


    public Class<?> getDataStoreIdType(ClassMetaData meta) {
        return Id.class;
    }

    public Object copyDataStoreId(Object oid, ClassMetaData meta) {
        Id id = (Id) oid;
        return new Id(meta.getDescribedType(), id.getId(), id.hasSubclasses());
    }
View Full Code Here

    public Class getDataStoreIdType(ClassMetaData meta) {
        return Id.class;
    }

    public Object copyDataStoreId(Object oid, ClassMetaData meta) {
        Id id = (Id) oid;
        return new Id(meta.getDescribedType(), id.getId(), id.hasSubclasses());
    }
View Full Code Here

    public Object newDataStoreId(Object val, ClassMetaData meta) {
        return Id.newInstance(meta.getDescribedType(), val);
    }

    public Id newDataStoreId(long id, ClassMapping mapping, boolean subs) {
        return new Id(mapping.getDescribedType(), id, subs);
    }
View Full Code Here

        if (oid == null || meta == null)
            return null;

        Class cls = meta.getDescribedType();
        if (meta.getIdentityType() == ClassMetaData.ID_DATASTORE)
            return new Id(cls, ((Number) oid).longValue());

        if (oid instanceof Byte)
            return new ByteId(cls, (Byte) oid);
        if (oid instanceof Character)
            return new CharId(cls, (Character) oid);
View Full Code Here

            startTx(em);
            em.persist(a);
            em.persist(aparent);
            oid = em.getObjectId(a);
            oidwithclass = new Id(CacheObjectA.class, oid.toString());
            parentOid = em.getObjectId(aparent);
            endTx(em);
        }
        finally {
            endEm(em);
View Full Code Here

    public void testExpiredRelations() {
        CacheObjectA a = (CacheObjectA) em.find(CacheObjectA.class, oid);
        em.refresh(a);
        Object relationOid = em.getObjectId(a.getRelatedObject());
        relationOid = new Id(CacheObjectA.class, relationOid.toString());

        ClassMetaData meta = repos.getMetaData(CacheObjectA.class, null, true);
        DataCache cache = meta.getDataCache();

        // drop the related data from the cache
View Full Code Here

            // get post-persist time for sleep calculations below
            Date persistTime = new Date();

            Object[] ids = new Object[4];
            ids[0] = new Id(CacheObjectE.class, em.getObjectId(e).toString());
            ids[1] = new Id(CacheObjectF.class, em.getObjectId(f).toString());
            ids[2] = new Id(CacheObjectG.class, em.getObjectId(g).toString());
            ids[3] = new Id(CacheObjectH.class, em.getObjectId(h).toString());

            // build up some queries to test

            // this one should be only on the superclass, since
            // CacheObjectF has a timeout.
View Full Code Here

            em.persist(j);
            endTx(em);
            Object hoid = em.getObjectId(h);
            Object joid = em.getObjectId(j);

            Object hoidwithclass = new Id(CacheObjectH.class, hoid.toString());
            Object joidwithclass = new Id(CacheObjectJ.class, joid.toString());
            endEm(em);

            // make sure j and h are in cache; may not be if not LRU
            int attempts = 0;
            for (; attempts < 100 && !cache.contains(joidwithclass); attempts++)
View Full Code Here

    public Class<?> getDataStoreIdType(ClassMetaData meta) {
        return Id.class;
    }

    public Object copyDataStoreId(Object oid, ClassMetaData meta) {
        Id id = (Id) oid;
        return new Id(meta.getDescribedType(), id.getId(), id.hasSubclasses());
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.util.Id

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.