Examples of CmpEntityBeanComponent


Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

        // Related Manager
        relatedManager = (JDBCStoreManager) relatedEntity.getManager();

        // Related Container
        CmpEntityBeanComponent relatedComponent = relatedManager.getComponent();
        this.relatedContainerRef = new WeakReference<CmpEntityBeanComponent>(relatedComponent);

        // related findByPrimaryKey
        Class homeClass = (relatedComponent.getLocalHomeClass() != null ?
                relatedComponent.getLocalHomeClass() : relatedComponent.getHomeClass());
        try {
            relatedFindByPrimaryKey =
                    homeClass.getMethod("findByPrimaryKey", new Class[]{relatedEntity.getPrimaryKeyClass()});
        } catch (Exception e) {
            throw CmpMessages.MESSAGES.findByPrimaryKeyNotFound(relatedEntity.getPrimaryKeyClass().getName(), homeClass.getName());
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

     * @param fk - foreign key value.
     * @return related local object instance.
     */
    public EJBLocalObject getRelatedEntityByFK(Object fk) {
        EJBLocalObject relatedLocalObject = null;
        final CmpEntityBeanComponent relatedContainer = getRelatedComponent();

        if (hasFKFieldsMappedToCMPFields && relatedManager.getReadAheadCache().getPreloadDataMap(fk, false) == null) {  // not in preload cache
            try {
                relatedLocalObject = relatedContainer.getEJBLocalObject(fk);
            } catch (Exception ignore) {
                // no such entity. it is ok to ignore
            }
        } else {
            relatedLocalObject = relatedContainer.getEJBLocalObject(fk);
        }

        return relatedLocalObject;
    }
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

        }
    }

    private Transaction getTransaction() {
        try {
            CmpEntityBeanComponent component = getJDBCStoreManager().getComponent();
            TransactionManager tm = component.getTransactionManager();
            return tm.getTransaction();
        } catch (SystemException e) {
            throw MESSAGES.errorGettingTxFromManager(e);
        }
    }
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

            }

            // construct a new relationSet
            try {
                // get the current transaction
                CmpEntityBeanComponent component = getJDBCStoreManager().getComponent();
                TransactionManager tm = component.getTransactionManager();
                Transaction tx = tm.getTransaction();

                // if whe have a valid transaction...
                if (tx != null && (tx.getStatus() == Status.STATUS_ACTIVE || tx.getStatus() == Status.STATUS_PREPARING)) {
                    // crete the relation set and register for a tx callback
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

    public JDBCSelectorBridge(JDBCStoreManager manager, JDBCQueryMetaData queryMetaData) {
        this.queryMetaData = queryMetaData;
        this.manager = manager;

        CmpEntityBeanComponent component = manager.getComponent();
        tm = component.getTransactionManager();
        syncBeforeSelect = !manager.getCmpConfig().isSyncOnCommitOnly();
    }
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

    public Object execute(CmpEntityBeanContext ctx, Object[] args) throws FinderException {
        Collection retVal;
        Method method = getMethod();
        try {
            JDBCQueryCommand query = manager.getQueryManager().getQueryCommand(method);
            final CmpEntityBeanComponent selectedComponent = query.getSelectManager().getComponent();
            JDBCQueryCommand.EntityProxyFactory factory = new JDBCQueryCommand.EntityProxyFactory() {
                public Object getEntityObject(Object primaryKey) {
                    return queryMetaData.isResultTypeMappingLocal() && selectedComponent.getLocalHomeClass() != null ?
                            selectedComponent.getEJBLocalObject(primaryKey) : selectedComponent.getEJBObject(primaryKey);
                }
            };
            retVal = query.execute(method, args, null, factory);
        } catch (FinderException e) {
            throw e;
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

        }

        // get the parameter order
        setParameterList(compiler.getInputParameters());

        final CmpEntityBeanComponent component = ((JDBCStoreManager) compiler.getStoreManager()).getComponent();
        EntityProxyFactory factoryToUse = new EntityProxyFactory() {
            public Object getEntityObject(Object primaryKey) {
                return metadata.isResultTypeMappingLocal() && component.getLocalHomeClass() != null ?
                        component.getEJBLocalObject(primaryKey) : component.getEJBObject(primaryKey);
            }
        };

        return execute(
                compiler.getSQL(),
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

        if (log.isDebugEnabled())
            log.debug("Remove: Rows affected = " + rowsAffected);
    }

    public void invokeRemoveRelated(Object relatedId) throws RemoveException, RemoteException {
        CmpEntityBeanComponent component = relatedManager.getComponent();

        /*
        try
        {
           EntityCache instanceCache = (EntityCache) container.getInstanceCache();
           SecurityActions actions = SecurityActions.UTIL.getSecurityActions();

           org.jboss.invocation.Invocation invocation = new org.jboss.invocation.Invocation();
           invocation.setId(instanceCache.createCacheKey(relatedId));
           invocation.setArguments(new Object[]{});
           invocation.setTransaction(container.getTransactionManager().getTransaction());
           invocation.setPrincipal(actions.getPrincipal());
           invocation.setCredential(actions.getCredential());
           invocation.setType(invocationType);
           invocation.setMethod(removeMethod);

           container.invoke(invocation);
        }
        catch(EJBException e)
        {
           throw e;
        }
        catch(Exception e)
        {
           throw new EJBException("Error in remove instance", e);
        }
        */

        /**
         * Have to remove through EJB[Local}Object interface since the proxy contains the 'removed' flag
         * to be set on removal.
         */
        if(component.getLocalClass() != null) {
            final EJBLocalObject ejbObject = component.getEJBLocalObject(relatedId);
            ejbObject.remove();
        } else {
            final EJBObject ejbObject = component.getEJBObject(relatedId);
            ejbObject.remove();
        }
    }
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

        // Related Manager
        relatedManager = (JDBCStoreManager) relatedEntity.getManager();

        // Related Container
        CmpEntityBeanComponent relatedComponent = relatedManager.getComponent();
        this.relatedContainerRef = new WeakReference<CmpEntityBeanComponent>(relatedComponent);

        // related findByPrimaryKey
        Class homeClass = (relatedComponent.getLocalHomeClass() != null ?
                relatedComponent.getLocalHomeClass() : relatedComponent.getHomeClass());
        try {
            relatedFindByPrimaryKey =
                    homeClass.getMethod("findByPrimaryKey", new Class[]{relatedEntity.getPrimaryKeyClass()});
        } catch (Exception e) {
            throw new RuntimeException("findByPrimaryKey(" +
View Full Code Here

Examples of org.jboss.as.cmp.component.CmpEntityBeanComponent

     * @param fk - foreign key value.
     * @return related local object instance.
     */
    public EJBLocalObject getRelatedEntityByFK(Object fk) {
        EJBLocalObject relatedLocalObject = null;
        final CmpEntityBeanComponent relatedContainer = getRelatedComponent();

        if (hasFKFieldsMappedToCMPFields && relatedManager.getReadAheadCache().getPreloadDataMap(fk, false) == null) {  // not in preload cache
            try {
                relatedLocalObject = relatedContainer.getEJBLocalObject(fk);
            } catch (Exception ignore) {
                // no such entity. it is ok to ignore
            }
        } else {
            relatedLocalObject = relatedContainer.getEJBLocalObject(fk);
        }

        return relatedLocalObject;
    }
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.