Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.Id


    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

        try {
            switch (meta.getIdentityType()) {
            case ClassMetaData.ID_DATASTORE:
                if (oid instanceof String && ((String) oid).startsWith(StateManagerId.STRING_PREFIX))
                    return new StateManagerId((String) oid);
                return new Id(cls, ((Number) oid).longValue());
            case ClassMetaData.ID_APPLICATION:
                if (ImplHelper.isAssignable(meta.getObjectIdType(), oid.getClass())) {
                    if (!meta.isOpenJPAIdentity() && meta.isObjectIdTypeShared())
                        return new ObjectId(cls, oid);
                    return oid;
View Full Code Here

        assertEquals(1, sql.size());
        assertNotSQL(_outer);
        sql.clear();
       
        // should outer join with non-exact oid
        oid = new Id(Base.class, ((Id) oid).getId());
        pm = (OpenJPAEntityManager)currentEntityManager();
        pc = (Base) pm.getObjectId(oid);
        assertEquals(1, pc.getBaseField());
        assertEquals(Base.class, pc.getClass());
        pm.close();
View Full Code Here

        Base pc = new Base();
        pc.setBaseField(1);
        Object oid = persist(pc);
        sql.clear();
       
        Id id = new Id(Base.class, -1);
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        try {
            pm.getObjectId(id);
            fail("No exception on bad id.");
        } catch (Exception jonfe) {
View Full Code Here

        assertEquals(1, sql.size());
        assertNotSQL(_outer);
        sql.clear();
       
        // should outer join with inexact oid
        oid = new Id(Base.class, ((Id) oid).getId());
        pm = (OpenJPAEntityManager)currentEntityManager();
        pc = (BaseSub1Sub2) pm.getObjectId(oid);
        assertEquals(4, pc.getBaseField());
        assertEquals(5, pc.getBaseSub1Field());
        assertEquals(6, pc.getBaseSub1Sub2Field());
View Full Code Here

        assertEquals(1, sql.size());
        assertNotSQL(_outer);
        sql.clear();
       
        // should outer join with inexact oid
        oid = new Id(Base.class, ((Id) oid).getId());
        pm = (OpenJPAEntityManager)currentEntityManager();
        pc = (BaseSub2) pm.getObjectId(oid);
        assertEquals(3, pc.getBaseField());
        assertEquals(4, pc.getBaseSub2Field());
        assertEquals(BaseSub2.class, pc.getClass());
View Full Code Here

        assertEquals(1, sql.size());
        assertNotSQL(_outer);
        sql.clear();
       
        // should outer join with inexact oid
        oid = new Id(Base.class, ((Id) oid).getId());
        pm = (OpenJPAEntityManager)currentEntityManager();
        pc = (BaseSub1) pm.getObjectId(oid);
        assertEquals(2, pc.getBaseField());
        assertEquals(3, pc.getBaseSub1Field());
        assertEquals(BaseSub1.class, pc.getClass());
View Full Code Here

        assertEquals(sql.toString(), 1, sql.size());
        assertNotSQL(_outer);
        sql.clear();
       
        // should outer join with non-exact id
        Id oid = new Id(JoinSubclassBase.class, ((Id) _base).getId());
        pm = (OpenJPAEntityManager)currentEntityManager();
        pc = (JoinSubclassBase) pm.getObjectId(oid);
        assertEquals(1, pc.getBaseField());
        pm.close();
       
View Full Code Here

        assertEquals(sql.toString(), 1, sql.size());
        assertNotSQL(_outer);
        sql.clear();
       
        // should outer join with non-exact id
        Id oid = new Id(JoinSubclassBase.class, ((Id) _baseSubFlat).getId());
        pm = (OpenJPAEntityManager)currentEntityManager();
        pc = (JoinSubclassBaseSubFlat) pm.getObjectId(oid);
        assertEquals(3, pc.getBaseField());
        assertEquals(4, pc.getBaseSubVertField());
        assertEquals(5, pc.getBaseSubFlatField());
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.