Package javax.jdo.spi

Examples of javax.jdo.spi.PersistenceCapable$ObjectIdFieldManager


   
    public ObjectAdapter lazilyLoaded(Object pojo) {
        if(!(pojo instanceof PersistenceCapable)) {
            return null;
        }
        final PersistenceCapable persistenceCapable = (PersistenceCapable) pojo;
        return frameworkSynchronizer.lazilyLoaded(persistenceCapable, CalledFrom.OS_LAZILYLOADED);
    }
View Full Code Here


public class Utils {

    @SuppressWarnings("unused")
    private static Object jdoObjectIdFor(InstanceLifecycleEvent event) {
        PersistenceCapable persistenceCapable = Utils.persistenceCapableFor(event);
        Object jdoObjectId = persistenceCapable.jdoGetObjectId();
        return jdoObjectId;
    }
View Full Code Here

    public void postLoadProcessingFor(final PersistenceCapable pojo, CalledFrom calledFrom) {

        withLogging(pojo, new Runnable() {
            @Override
            public void run() {
                final PersistenceCapable pc = pojo;
                final Version datastoreVersion = getVersionIfAny(pc);
               
                final RootOid originalOid ;
                ObjectAdapter originalAdapter = getAdapterManager().getAdapterFor(pojo);
                if(originalAdapter != null) {
View Full Code Here

        //
        ext = pmJDOI.getExtent(User.class, true);
        iter = ext.iterator();
        while (iter.hasNext()) {
            PersistenceCapable itemCurso = (PersistenceCapable) iter.next();
            if (itemCurso != null) {
                setPersistentes.add(itemCurso);
            }

        }

        //
        ext = pmJDOI.getExtent(Curso.class, true);
        iter = ext.iterator();
        while (iter.hasNext()) {
            PersistenceCapable itemCurso = (PersistenceCapable) iter.next();
            if (itemCurso != null) {
                setPersistentes.add(itemCurso);
            }

        }
        //
        ext = pmJDOI.getExtent(Alumno.class, true);
        iter = ext.iterator();
        while (iter.hasNext()) {
            PersistenceCapable itemCurso = (PersistenceCapable) iter.next();
            if (itemCurso != null) {
                setPersistentes.add(itemCurso);
            }

        }
        //
        ext = pmJDOI.getExtent(Persona.class, true);
        iter = ext.iterator();
        while (iter.hasNext()) {
            PersistenceCapable itemCurso = (PersistenceCapable) iter.next();
            if (itemCurso != null) {
                setPersistentes.add(itemCurso);
            }

        }

        //
        ext = pmJDOI.getExtent(Periodo.class, true);
        iter = ext.iterator();
        while (iter.hasNext()) {
            PersistenceCapable itemCurso = (PersistenceCapable) iter.next();
            if (itemCurso != null) {
                setPersistentes.add(itemCurso);
            }

        }

        //
        ext = pmJDOI.getExtent(Pago.class, true);
        iter = ext.iterator();
        while (iter.hasNext()) {
            PersistenceCapable itemCurso = (PersistenceCapable) iter.next();
            if (itemCurso != null) {
                setPersistentes.add(itemCurso);
            }

        }
        //
        ext = pmJDOI.getExtent(CuotaBasica.class, true);
        iter = ext.iterator();
        while (iter.hasNext()) {
            PersistenceCapable itemCurso = (PersistenceCapable) iter.next();
            if (itemCurso != null) {
                setPersistentes.add(itemCurso);
            }

        }
View Full Code Here

        }
    }

    public void postDelete( InstanceLifecycleEvent evt )
    {
        PersistenceCapable obj = ( (PersistenceCapable) evt.getSource() );

        if ( obj == null )
        {
            // Do not track null objects.
            // These events are typically a product of an internal lifecycle event.
View Full Code Here

    public void persist(Object entity) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("JPA Persist - entity: " + entity);
        }
        if (entity instanceof PersistenceCapable) {
            PersistenceCapable pc = (PersistenceCapable) entity;
            if (pc.jdoIsDetached()) {
                /**
                 * Sec - 3.2.2
                 * If X is a detached object, the EntityExistsException may be thrown when the persist
                 * operation is invoked, or the EntityExistsException or another PersistenceException may be thrown
                 * at flush or commit time
                 */
                throwException(new EntityExistsException("Entity already exists. Use merge to save changes."));
            }
            // We may have added a state manager which is not needed for persist calls
            StateManager sm = om.findStateManager(entity);
            if (sm != null) {
                if (sm instanceof ForceJPAStateManagerImpl) {
                    om.clearDirty(sm);
                    om.removeStateManager(sm);
                    pc.jdoReplaceStateManager(null);
                } else {
                    /**
                     * Sec - 3.2.2
                     * If X is a preexisting managed entity, it is ignored by the persist operation. However, the persist
                     * operation is cascaded to entities referenced by X, if the relationships from X to these other
View Full Code Here

    public Object merge(Object entity) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("JPA Merge: - entity: " + entity);
        }
        if (entity instanceof PersistenceCapable) {
            PersistenceCapable pc = (PersistenceCapable) entity;
            if (pc.jdoIsDetached() && pc.jdoGetObjectId() == null) {
                throw new IllegalArgumentException("Detached entity with null id cannot be merged.");
            }
            // Read id from entity
            StateManager sm = om.findStateManager(entity);
            if (sm != null) {
View Full Code Here

   
    public ObjectAdapter lazilyLoaded(Object pojo) {
        if(!(pojo instanceof PersistenceCapable)) {
            return null;
        }
        final PersistenceCapable persistenceCapable = (PersistenceCapable) pojo;
        return frameworkSynchronizer.lazilyLoaded(persistenceCapable, CalledFrom.OS_LAZILYLOADED);
    }
View Full Code Here

        }
    }

    public void postDelete( InstanceLifecycleEvent evt )
    {
        PersistenceCapable obj = ( (PersistenceCapable) evt.getSource() );

        if ( obj == null )
        {
            // Do not track null objects.
            // These events are typically a product of an internal lifecycle event.
View Full Code Here

     * @param pojos the OJB pojos as obtained by the broker
     * @return the collection of JDO PersistenceCapable instances
     */
    protected Collection provideStateManagers(Collection pojos)
    {
      PersistenceCapable pc;
      int [] fieldNums;
      Iterator iter = pojos.iterator();
      Collection result = new ArrayList();
     
      while (iter.hasNext())
      {
        // obtain a StateManager
        pc = (PersistenceCapable) iter.next();
        Identity oid = new Identity(pc, broker);
        StateManagerInternal smi = pmi.getStateManager(oid, pc.getClass());
       
        // fetch attributes into StateManager
      JDOClass jdoClass = Helper.getJDOClass(pc.getClass());
      fieldNums = jdoClass.getManagedFieldNumbers();

      FieldManager fm = new OjbFieldManager(pc, broker);
      smi.replaceFields(fieldNums, fm);
      smi.retrieve();
View Full Code Here

TOP

Related Classes of javax.jdo.spi.PersistenceCapable$ObjectIdFieldManager

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.