Package org.jpox.identity

Examples of org.jpox.identity.OID


                    {
                        // Datastore identity
                        for (int i=0; i<expr.expressionList.size(); i++)
                        {
                            ScalarExpression source = expr.expressionList.getExpression(i);
                            OID objectId = (OID)api.getIdForObject(value);
                            if (objectId == null)
                            {
                                // PC object with no id (embedded, or transient maybe)
                                // Query should return nothing (so just do "(1 = 0)")
                                JPOXLogger.QUERY.warn(LOCALISER.msg("037003", value));
                                bExpr = new BooleanLiteral(qs, mapping, false).eq(new BooleanLiteral(qs, mapping, true));
                                // It is arguable that we should compare the id with null (as below)
                                /*bExpr = expr.eq(new NullLiteral(qs));*/
                            }
                            else
                            {
                                JavaTypeMapping m = dba.getMapping(objectId.getKeyValue().getClass(), storeMgr, clr);
                                ScalarExpression oidExpr = m.newLiteral(qs, objectId.getKeyValue());
                                bExpr = source.eq(oidExpr);
                            }
                        }
                    }
                }
View Full Code Here


            getDataStoreMapping(0).setObject(ps, param[0], null);
        }
        else
        {
            ApiAdapter api = om.getApiAdapter();
            OID oid;
            if (api.isPersistable(value))
            {
                oid = (OID) api.getIdForObject(value);
                if (oid == null)
                {
                    if (om.isInserting(value))
                    {
                        // Object is in the process of being inserted, but has no id yet so provide a null for now
                        // The "NotYetFlushedException" is caught by ParameterSetter and processed as an update being required.
                        getDataStoreMapping(0).setObject(ps, param[0], null);
                        throw new NotYetFlushedException(value);
                    }
                    else
                    {
                        // Object is not persist, nor in the process of being made persistent
                        om.persistObjectInternal(value, null, null, -1, StateManager.PC);
                        om.flushInternal(false);
                    }
                }
                oid = (OID) api.getIdForObject(value);
            }
            else
            {
                oid = (OID) value;
            }

            try
            {
                // Try as a Long
                getDataStoreMapping(0).setObject(ps,param[0],oid.getKeyValue());
            }
            catch (Exception e)
            {
                // Must be a String
                getDataStoreMapping(0).setObject(ps,param[0],oid.getKeyValue().toString());
            }
        }
    }
View Full Code Here

        ApiAdapter api = getApiAdapter();

        if (id instanceof OID)
        {
            // Object is an OID
            OID oid = (OID) id;
            cmd = getMetaDataManager().getMetaDataForClass(oid.getPcClass(), clr);
            if( cmd.getDiscriminatorStrategy() == null)
            {
                // Using SingleFieldIdentity so can assume that object is of the target class or a subclass
                List subclasses = new ArrayList(this.getSubClassesForClass(oid.getPcClass(), true, clr));
                if (subclasses.size() < 1)
                {
                    JPOXLogger.PERSISTENCE.debug("1) Id \""+id+"\" has been determined to be the id of class "+oid.getPcClass());
                    // No subclasses so must be an instance of the OID class
                    return oid.getPcClass();
                }
                targetClassName = oid.getPcClass();
            }
        }
        else if (api.isSingleFieldIdentity(id))
        {
            // Using SingleFieldIdentity so can assume that object is of the target class or a subclass
View Full Code Here

TOP

Related Classes of org.jpox.identity.OID

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.