Examples of ObjectExistsException


Examples of org.apache.openjpa.util.ObjectExistsException

        // ACT_RUN
        PersistenceCapable pc;
        if (sm != null) {
            if (sm.isDetached()) {
                throw new ObjectExistsException(_loc.get("persist-detached", Exceptions.toString(obj)))
                    .setFailedObject(obj);
            }

            if (!sm.isEmbedded()) {
                sm.persist();
                _cache.persist(sm);
                if ((action & OpCallbacks.ACT_CASCADE) != 0) {
                    sm.cascadePersist(call);
                }
                return sm;
            }

            // an embedded field; notify the owner that the value has
            // changed by becoming independently persistent
            sm.getOwner().dirty(sm.getOwnerIndex());
            _cache.persist(sm);
            pc = sm.getPersistenceCapable();
        } else {
            pc = assertPersistenceCapable(obj);
            if (pc.pcIsDetached() == Boolean.TRUE) {
                throw new ObjectExistsException(_loc.get("persist-detached", Exceptions.toString(obj)))
                    .setFailedObject(obj);
            }
        }

        ClassMetaData meta = _repo.getMetaData(obj.getClass(), _loader, true);
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

        if (pks != null && pks.length == 1 && pks[0].getValueStrategy() == ValueStrategies.AUTOASSIGN) {
            return;
        }
        StateManagerImpl other = getStateManagerImplById(id, false);
        if (other != null && !other.isDeleted() && !other.isNew())
            throw new ObjectExistsException(_loc.get("cache-exists",
                obj.getClass().getName(), id)).setFailedObject(obj);
    }
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

        switch (errorType) {
        case StoreException.LOCK:
            storeEx = new LockException(failed);
            break;
        case StoreException.OBJECT_EXISTS:
            storeEx = new ObjectExistsException(msg);
            break;
        case StoreException.OBJECT_NOT_FOUND:
            storeEx = new ObjectNotFoundException(failed);
            break;
        case StoreException.OPTIMISTIC:
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

        // ACT_RUN
        PersistenceCapable pc;
        if (sm != null) {
            if (sm.isDetached()) {
                throw new ObjectExistsException(_loc.get("persist-detached", Exceptions.toString(obj)))
                    .setFailedObject(obj);
            }

            if (!sm.isEmbedded()) {
                sm.persist();
                _cache.persist(sm);
                if ((action & OpCallbacks.ACT_CASCADE) != 0) {
                    sm.cascadePersist(call);
                }
                return sm;
            }

            // an embedded field; notify the owner that the value has
            // changed by becoming independently persistent
            sm.getOwner().dirty(sm.getOwnerIndex());
            _cache.persist(sm);
            pc = sm.getPersistenceCapable();
        } else {
            pc = assertPersistenceCapable(obj);
            if (pc.pcIsDetached() == Boolean.TRUE) {
                throw new ObjectExistsException(_loc.get("persist-detached", Exceptions.toString(obj)))
                    .setFailedObject(obj);
            }
        }

        ClassMetaData meta = _repo.getMetaData(obj.getClass(), _loader, true);
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

        if (pks != null && pks.length == 1 && pks[0].getValueStrategy() == ValueStrategies.AUTOASSIGN) {
            return;
        }
        StateManagerImpl other = getStateManagerImplById(id, false);
        if (other != null && !other.isDeleted() && !other.isNew())
            throw new ObjectExistsException(_loc.get("cache-exists",
                obj.getClass().getName(), id)).setFailedObject(obj);
    }
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

        switch (errorType) {
        case StoreException.LOCK:
            storeEx = new LockException(failed);
            break;
        case StoreException.OBJECT_EXISTS:
            storeEx = new ObjectExistsException(msg);
            break;
        case StoreException.OBJECT_NOT_FOUND:
            storeEx = new ObjectNotFoundException(failed);
            break;
        case StoreException.OPTIMISTIC:
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

        switch (errorType) {
        case StoreException.LOCK:
            storeEx = new LockException(failed);
            break;
        case StoreException.OBJECT_EXISTS:
            storeEx = new ObjectExistsException(msg);
            break;
        case StoreException.OBJECT_NOT_FOUND:
            storeEx = new ObjectNotFoundException(failed);
            break;
        case StoreException.OPTIMISTIC:
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

            // ACT_RUN
            PersistenceCapable pc;
            if (sm != null) {
                if (sm.isDetached())
                    throw new ObjectExistsException(_loc.get
                        ("persist-detached", Exceptions.toString(obj))).
                        setFailedObject(obj);

                if (!sm.isEmbedded()) {
                    sm.persist();
                    _cache.persist(sm);
                    if ((action & OpCallbacks.ACT_CASCADE) != 0)
                        sm.cascadePersist(call);
                    return sm;
                }

                // an embedded field; notify the owner that the value has
                // changed by becoming independently persistent
                sm.getOwner().dirty(sm.getOwnerIndex());
                _cache.persist(sm);
                pc = sm.getPersistenceCapable();
            } else {
                pc = assertPersistenceCapable(obj);
                if (pc.pcIsDetached() == Boolean.TRUE)
                    throw new ObjectExistsException(_loc.get
                        ("persist-detached", Exceptions.toString(obj))).
                        setFailedObject(obj);
            }

            ClassMetaData meta = _conf.getMetaDataRepositoryInstance().
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

     * This method makes sure we don't already have the instance cached
     */
    protected void checkForDuplicateId(Object id, Object obj) {
        StateManagerImpl other = getStateManagerImplById(id, false);
        if (other != null && !other.isDeleted() && !other.isNew())
            throw new ObjectExistsException(_loc.get("cache-exists",
                obj.getClass().getName(), id)).setFailedObject(obj);
    }
View Full Code Here

Examples of org.apache.openjpa.util.ObjectExistsException

            // ACT_RUN
            PersistenceCapable pc;
            if (sm != null) {
                if (sm.isDetached())
                    throw new ObjectExistsException(_loc.get
                        ("persist-detached", Exceptions.toString(obj))).
                        setFailedObject(obj);

                if (!sm.isEmbedded()) {
                    sm.persist();
                    _cache.persist(sm);
                    if ((action & OpCallbacks.ACT_CASCADE) != 0)
                        sm.cascadePersist(call);
                    return sm;
                }

                // an embedded field; notify the owner that the value has
                // changed by becoming independently persistent
                sm.getOwner().dirty(sm.getOwnerIndex());
                _cache.persist(sm);
                pc = sm.getPersistenceCapable();
            } else {
                pc = assertPersistenceCapable(obj);
                if (pc.pcIsDetached() == Boolean.TRUE)
                    throw new ObjectExistsException(_loc.get
                        ("persist-detached", Exceptions.toString(obj))).
                        setFailedObject(obj);
            }

            ClassMetaData meta = _conf.getMetaDataRepositoryInstance().
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.