Package javax.jdo

Examples of javax.jdo.JDOUserException


    public synchronized Object getObjectById(Object id, boolean validate)
    {
        assertIsOpen();
        if (id == null)
        {
            throw new JDOUserException(LOCALISER.msg("010044"));
        }

        try
        {
            // Use inheritance checks according to persistence property
View Full Code Here


    public Collection getObjectsById(Collection oids, boolean validate)
    {
        assertIsOpen();
        if (oids == null || oids.size() == 0)
        {
            throw new JDOUserException(LOCALISER_JDO.msg("011002"));
        }

        Collection objects = new ArrayList(oids.size());
        Iterator iter = oids.iterator();
        while (iter.hasNext())
View Full Code Here

    public Object[] getObjectsById(Object[] oids, boolean validate)
    {
        assertIsOpen();
        if (oids == null)
        {
            throw new JDOUserException(LOCALISER_JDO.msg("011002"));
        }
        Object[] objects = new Object[oids.length];
        for (int i = 0; i < oids.length; i++)
        {
            // Just use getObjectById to get the object
View Full Code Here

        }

        if (objectMgr.getTransaction().getOptimistic())
        {
            // TODO Implement checkConsistency() for optimistic transactions
            throw new JDOUserException("checkConsistency() not yet implemented for optimistic transactions");
        }
        else
        {
            flush();
        }
View Full Code Here

        assertIsOpen();

        SequenceMetaData seqmd = objectMgr.getMetaDataManager().getMetaDataForSequence(objectMgr.getClassLoaderResolver(),sequenceName);
        if (seqmd == null)
        {
            throw new JDOUserException(LOCALISER.msg("017000", sequenceName));
        }

        Sequence seq = null;
        if (seqmd.getFactoryClass() != null)
        {
            // User has specified a factory class
            seq = getAbstractPersistenceManagerFactory().getSequenceForFactoryClass(seqmd.getFactoryClass());
            if (seq == null)
            {
                // Create a new instance of the factory class and obtain the Sequence
                Class factory = objectMgr.getClassLoaderResolver().classForName(seqmd.getFactoryClass());
                if (factory == null)
                {
                    throw new JDOUserException(LOCALISER.msg("017001", sequenceName, seqmd.getFactoryClass()));
                }

                Class[] argTypes = null;
                Object[] arguments = null;
                if (seqmd.getStrategy() != null)
                {
                    argTypes = new Class[2];
                    argTypes[0] = String.class;
                    argTypes[1] = String.class;
                    arguments = new Object[2];
                    arguments[0] = seqmd.getName();
                    arguments[1] = seqmd.getStrategy().toString();
                }
                else
                {
                    argTypes = new Class[1];
                    argTypes[0] = String.class;
                    arguments = new Object[1];
                    arguments[0] = seqmd.getName();
                }

                Method newInstanceMethod;
                try
                {
                    // Obtain the sequence from the static "newInstance(...)" method
                    newInstanceMethod = factory.getMethod("newInstance", argTypes);
                    seq = (Sequence) newInstanceMethod.invoke(null, arguments);
                }
                catch (Exception e)
                {
                    throw new JDOUserException(LOCALISER.msg("017002", seqmd.getFactoryClass(), e.getMessage()));
                }

                // Register the sequence with the PMF
                getAbstractPersistenceManagerFactory().addSequenceForFactoryClass(seqmd.getFactoryClass(), seq);
            }
View Full Code Here

     */
    protected void assertReadable(String operation)
    {
        if (!objectMgr.getTransaction().isActive() && !objectMgr.getTransaction().getNontransactionalRead())
        {
            throw new JDOUserException(LOCALISER_JDO.msg("011001", operation));
        }
    }
View Full Code Here

    protected void assertIsOpen()
    {
        if (!isOpen())
        {
            // TODO Should not throw JDOException when not using JDO
            throw new JDOUserException(LOCALISER.msg("052600"));
        }
    }
View Full Code Here

     */
    public void close()
    {
        if (!isAvailable)
        {
            throw new JDOUserException(LOCALISER.msg("046001"));
        }
        isAvailable = false;
        onClose.run();
    }
View Full Code Here

            {
                if (jpe.getNestedExceptions() != null)
                {
                    if (jpe.getFailedObject() != null)
                    {
                        return new JDOUserException(jpe.getMessage(), jpe.getNestedExceptions(), jpe.getFailedObject());
                    }
                    return new JDOUserException(jpe.getMessage(), jpe.getNestedExceptions());
                }
                else if (jpe.getFailedObject() != null)
                {
                    return new JDOUserException(jpe.getMessage(), jpe.getFailedObject());
                }
                else
                {
                    return new JDOUserException(jpe.getMessage(), jpe);
                }
            }
        }
        else if (jpe instanceof JPOXOptimisticException)
        {
View Full Code Here

        if (!disconnectClone(pc))
        {
            int fieldNumber = cmd.getAbsolutePositionOfMember(fieldName);
            if (fieldNumber == -1)
            {
                throw new JDOUserException(LOCALISER.msg("026002", fieldName, cmd.getFullClassName()));
            }
           
            makeDirty(fieldNumber);
        }
    }
View Full Code Here

TOP

Related Classes of javax.jdo.JDOUserException

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.