Examples of JDBCEntityPersistenceStore


Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

    }

    protected void invokeEjbPostCreate(final InterceptorContext context, final Method ejbPostCreate, final EntityBeanComponentInstance instance, final Object[] params) throws Exception {
        final CmpEntityBeanComponentInstance cmpInstance = CmpEntityBeanComponentInstance.class.cast(instance);
        final CmpEntityBeanComponent component = cmpInstance.getComponent();
        final JDBCEntityPersistenceStore storeManager = component.getStoreManager();
        storeManager.postCreateEntity(context.getMethod(), context.getParameters(), cmpInstance.getEjbContext());
        ejbPostCreate.invoke(instance.getInstance(), params);

        if (storeManager.getCmpConfig().isInsertAfterEjbPostCreate()) {
            storeManager.createEntity(context.getMethod(), context.getParameters(), cmpInstance.getEjbContext());
        }

        final Transaction transaction = component.getTransactionManager().getTransaction();
        if (TxUtils.isActive(transaction)) {
            TransactionEntityMap.NONE.scheduleSync(transaction, cmpInstance.getEjbContext());
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

        EntityBean instance = getInstance();
        try {
            if (!isRemoved()) {
                instance.ejbStore();
                final CmpEntityBeanContext context = getEjbContext();
                final JDBCEntityPersistenceStore store = getComponent().getStoreManager();
                if (context.getPrimaryKey() != null && store.isStoreRequired(context)) {
                    store.storeEntity(context);
                }
            }
        } catch (RemoteException e) {
            throw new WrappedRemoteException(e);
        } catch (Exception e) {
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

            throw new EJBException(e);
        }
    }

    public void passivate() {
        final JDBCEntityPersistenceStore store = getComponent().getStoreManager();
        try {
            store.passivateEntity(this.getEjbContext());
        } catch (RemoteException e) {
            throw new WrappedRemoteException(e);
        } catch (Exception e) {
            throw new EJBException(e);
        }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

        super(applicationName, moduleName, distinctName, beanName);
    }

    protected Object invokeEjbCreate(final Map<Object, Object> contextData, final Method ejbCreate, final EntityBeanComponentInstance instance, final Object[] params) throws Exception {
        final CmpEntityBeanComponentInstance cmpInstance = CmpEntityBeanComponentInstance.class.cast(instance);
        final JDBCEntityPersistenceStore storeManager = cmpInstance.getComponent().getStoreManager();
        storeManager.initEntity(cmpInstance.getEjbContext());
        ejbCreate.invoke(instance.getInstance(), params);
        return storeManager.createEntity(ejbCreate, params, cmpInstance.getEjbContext());
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

    }

    protected void invokeEjbPostCreate(final Map<Object, Object> contextData, final Method ejbPostCreate, final EntityBeanComponentInstance instance, final Object[] params) throws Exception {
        final CmpEntityBeanComponentInstance cmpInstance = CmpEntityBeanComponentInstance.class.cast(instance);
        final CmpEntityBeanComponent component = cmpInstance.getComponent();
        final JDBCEntityPersistenceStore storeManager = component.getStoreManager();
        storeManager.postCreateEntity(ejbPostCreate, params, cmpInstance.getEjbContext());
        ejbPostCreate.invoke(instance.getInstance(), params);

        if (storeManager.getCmpConfig().isInsertAfterEjbPostCreate()) {
            storeManager.createEntity(ejbPostCreate, params, cmpInstance.getEjbContext());
        }

        final Transaction transaction = component.getTransactionManager().getTransaction();
        if (TxUtils.isActive(transaction)) {
            TransactionEntityMap.NONE.scheduleSync(transaction, cmpInstance.getEjbContext());
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

            cmpComponent.getComponentClass().getDeclaredMethod(finderMethod.getName(), finderMethod.getParameterTypes());
            return super.invokeFind(context, instance);
        } catch (NoSuchMethodException ignored) {
        }

        final JDBCEntityPersistenceStore store = cmpComponent.getStoreManager();

        final CmpEntityBeanContext entityContext = cmpInstance.getEjbContext();

        // as per the spec 9.6.4, entities must be synchronized with the datastore when an ejbFind<METHOD> is called.
        if (!store.getCmpConfig().isSyncOnCommitOnly()) {
            cmpComponent.synchronizeEntitiesWithinTransaction(entityContext.getTransaction());
        }

        final JDBCQueryCommand.EntityProxyFactory factory = new JDBCQueryCommand.EntityProxyFactory() {
            public Object getEntityObject(final Object primaryKey) {
                return localHome ? cmpComponent.getEJBLocalObject(primaryKey) : cmpComponent.getEJBObject(primaryKey);
            }
        };

        if (getReturnType() == ReturnType.SINGLE) {
            return store.findEntity(context.getMethod(), context.getParameters(), entityContext, factory);
        } else {
            return store.findEntities(context.getMethod(), context.getParameters(), entityContext, factory);
        }
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

            if (!isRemoved()) {

                invokeEjbStore();

                final CmpEntityBeanContext context = getEjbContext();
                final JDBCEntityPersistenceStore store = getComponent().getStoreManager();
                if (context.getPrimaryKey() != null && store.isStoreRequired(context)) {
                    store.storeEntity(context);
                }
            }
        } catch (RemoteException e) {
            throw new WrappedRemoteException(e);
        } catch (Exception e) {
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

            throw new EJBException(e);
        }
    }

    public void passivate() {
        final JDBCEntityPersistenceStore store = getComponent().getStoreManager();
        try {
            store.passivateEntity(this.getEjbContext());
        } catch (RemoteException e) {
            throw new WrappedRemoteException(e);
        } catch (Exception e) {
            throw new EJBException(e);
        }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

        super(applicationName, moduleName, distinctName, beanName);
    }

    protected Object invokeEjbCreate(final Map<Object, Object> contextData, final Method ejbCreate, final EntityBeanComponentInstance instance, final Object[] params) throws Exception {
        final CmpEntityBeanComponentInstance cmpInstance = CmpEntityBeanComponentInstance.class.cast(instance);
        final JDBCEntityPersistenceStore storeManager = cmpInstance.getComponent().getStoreManager();
        storeManager.initEntity(cmpInstance.getEjbContext());
        try {
            ejbCreate.invoke(instance.getInstance(), params);
        } catch (InvocationTargetException ite) {
            throw Interceptors.rethrow(ite.getCause());
        }
        return storeManager.createEntity(ejbCreate, params, cmpInstance.getEjbContext());
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore

    }

    protected void invokeEjbPostCreate(final Map<Object, Object> contextData, final Method ejbPostCreate, final EntityBeanComponentInstance instance, final Object[] params) throws Exception {
        final CmpEntityBeanComponentInstance cmpInstance = CmpEntityBeanComponentInstance.class.cast(instance);
        final CmpEntityBeanComponent component = cmpInstance.getComponent();
        final JDBCEntityPersistenceStore storeManager = component.getStoreManager();
        storeManager.postCreateEntity(ejbPostCreate, params, cmpInstance.getEjbContext());
        try {
            ejbPostCreate.invoke(instance.getInstance(), params);
        } catch (InvocationTargetException ite) {
            throw Interceptors.rethrow(ite.getCause());
        }

        if (storeManager.getCmpConfig().isInsertAfterEjbPostCreate()) {
            storeManager.createEntity(ejbPostCreate, params, cmpInstance.getEjbContext());
        } else {
            // Invoke store after post create
            cmpInstance.store();
        }
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.