Package javax.jdo.identity

Examples of javax.jdo.identity.LongIdentity


            }
            if("i".equals(distinguisher)) {
                return new IntIdentity(objectTypeClassFor(oid), keyStr);
            }
            if("l".equals(distinguisher)) {
                return new LongIdentity(objectTypeClassFor(oid), keyStr);
            }
            if("b".equals(distinguisher)) {
                return new ByteIdentity(objectTypeClassFor(oid), keyStr);
            }
            if("u".equals(distinguisher)) {
View Full Code Here


        icompany.setName("GooTube");
        icompany.setFounded(new Date());

        tx.begin();
        pm.makePersistent(icompany);
        LongIdentity ioid = (LongIdentity)pm.getObjectId(icompany);
        tx.commit();

        Class pICompanyOidTargetClass = ioid.getTargetClass();
        if (pICompanyOidTargetClass != PICompany.class)
            appendMessage(ASSERTION_FAILED +
                 " getObjectId(icompany) should return interface class.\n" +
                    "expected: " + icompany.getClass().getName() + "\n" +
                    "actual: " + pICompanyOidTargetClass.getName());
View Full Code Here

        Transaction tx = null;
        try {
            pm = getPM();
            pm.currentTransaction().begin();
            // create the oid
            Object abstractOid = new LongIdentity(Employee.class, id);
            pm.getObjectById(abstractOid, false);
            appendMessage(ASSERTION_FAILED + "getObjectById exact " +
                    "for abstract superclass must fail.");
        } catch (JDOException ex) {
            // good catch
View Full Code Here

        Transaction tx = null;
        try {
            pm = getPM();
            pm.currentTransaction().begin();
            // create the oid
            Object abstractOid = new LongIdentity(Employee.class, id);
            Object abstractInstance = pm.getObjectById(abstractOid, true);
            if (abstractInstance.getClass() != FullTimeEmployee.class) {
                appendMessage(ASSERTION_FAILED + "getObjectById not exact "
                        + "for abstract superclass returned wrong type "
                        + abstractInstance.getClass().getName());
View Full Code Here

        Person instance = null;
        try {
            pm = getPM();
            pm.currentTransaction().begin();
            // create the oid
            Object superclassOid = new LongIdentity(Person.class, id);
            instance = (Person)pm.getObjectById(superclassOid, false);
            if (instance.getClass() != Person.class) {
                appendMessage(ASSERTION_FAILED + "getObjectById exact for "
                        + "concrete superclass should return "
                        + "Person.class but returned wrong type "
View Full Code Here

        Transaction tx = null;
        try {
            pm = getPM();
            pm.currentTransaction().begin();
            // create the oid
            Object superclassOid = new LongIdentity(Person.class, id);
            Object instance = pm.getObjectById(superclassOid, true);
            if (instance.getClass() !=  FullTimeEmployee.class) {
                appendMessage(ASSERTION_FAILED + "getObjectById not exact for "
                        + "concrete superclass should return FullTimeEmployee "
                        + "but returned wrong type "
View Full Code Here

        Transaction tx = null;
        try {
            pm = getPM();
            pm.currentTransaction().begin();
            // create the oid
            Object wrongOid = new LongIdentity(PartTimeEmployee.class, id);
            PartTimeEmployee wrongInstance =
                    (PartTimeEmployee)pm.getObjectById(wrongOid, false);
            wrongInstance.toString();
            appendMessage(ASSERTION_FAILED + " getObjectById exact "
                    + "for wrong class must throw JDOUserException.");
View Full Code Here

        Transaction tx = null;
        try {
            pm = getPM();
            pm.currentTransaction().begin();
            // create the oid
            Object rightOid = new LongIdentity(FullTimeEmployee.class, id);
            FullTimeEmployee rightInstance =
                    (FullTimeEmployee)pm.getObjectById(rightOid, true);
            rightInstance.toString();
        } catch (JDOException ex) {
            appendMessage(ASSERTION_FAILED + " getObjectById not exact "
View Full Code Here

        Transaction tx = null;
        try {
            pm = getPM();
            pm.currentTransaction().begin();
            // create the oid
            Object rightOid = new LongIdentity(FullTimeEmployee.class, id);
            FullTimeEmployee rightInstance =
                    (FullTimeEmployee)pm.getObjectById(rightOid, false);
            rightInstance.toString();
        } catch (JDOException ex) {
            appendMessage(ASSERTION_FAILED + " getObjectById exact "
View Full Code Here

            }
            if("i".equals(firstPart)) {
                return new IntIdentity(objectTypeClassFor(oid), keyStr);
            }
            if("l".equals(firstPart)) {
                return new LongIdentity(objectTypeClassFor(oid), keyStr);
            }
            if("b".equals(firstPart)) {
                return new ByteIdentity(objectTypeClassFor(oid), keyStr);
            }
View Full Code Here

TOP

Related Classes of javax.jdo.identity.LongIdentity

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.