Package org.jboss.as.cmp.jdbc2.schema

Examples of org.jboss.as.cmp.jdbc2.schema.EntityTable$Row


            loaded = true;
        }

        private Object getLoadedValue(CmpEntityBeanContext ctx) {
            if (!loaded) {
                PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();
                pctx.loadCachedRelations(cmrIndex, this);
                if (!loaded) {
                    loader.load(ctx, this);
                    loaded = true;
                    cacheValue(ctx);
                }
View Full Code Here


        public Object getCachedValue() {
            return value;
        }

        public void cacheValue(CmpEntityBeanContext ctx) {
            PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();
            pctx.cacheRelations(cmrIndex, this);
        }
View Full Code Here

            }
            return value;
        }

        private void loadOnlyFromCache(CmpEntityBeanContext ctx) {
            PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();
            if (pctx == null) {
                throw new EJBException("Persistence context is not available! Make sure the CMR collection is accessed in the transaction it was obtained.");
            }
            pctx.loadCachedRelations(cmrIndex, this);
        }
View Full Code Here

            for (int i = 0; i < foreignKeyFields.length; ++i) {
                foreignKeyFields[i].setValueInternal(ctx, null, fkConstraint == null);
            }

            if (fkConstraint != null) {
                PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();
                pctx.nullForeignKey(fkConstraint);
            }
        }
View Full Code Here

                Object fieldValue = relatedPKField.getPrimaryKeyValue(relatedId);
                foreignKeyFields[i].setValueInternal(ctx, fieldValue, markDirty);
            }

            if (fkConstraint != null) {
                PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();
                if (relatedId == null) {
                    pctx.nullForeignKey(fkConstraint);
                } else {
                    pctx.nonNullForeignKey(fkConstraint);
                }
            }
        }
View Full Code Here

        Object instance = ctx.getComponent().getCache().get(ctx.getPrimaryKey());
        // TODO: jeb - Set context on proxy
    }

    public void initInstance(CmpEntityBeanContext ctx) {
        ctx.setPersistenceContext(new PersistentContext(this, table.getRow(ctx.getPrimaryKey())));
        for (int i = 0; i < tableFields.length; ++i) {
            tableFields[i].initInstance(ctx);
        }

        for (int i = 0; i < cmrFields.length; ++i) {
View Full Code Here

        return fields;
    }

    public boolean isStoreRequired(CmpEntityBeanContext instance) {
        PersistentContext pctx = (PersistentContext) instance.getPersistenceContext();
        return pctx.isDirty();
    }
View Full Code Here

        for (JDBCQueryMetaData metadata : queries) {
            if (metadata.getMethod().getName().startsWith("ejbSelect")) {
                try {
                    QueryCommand queryCommand = queryFactory.getQueryCommand(metadata.getMethod());
                    Schema schema = ((JDBCStoreManager2) entityBridge.getManager()).getSchema();
                    EJBSelectBridge ejbSelectBridge = new EJBSelectBridge((JDBCStoreManager2) entityBridge.getManager(), entityBridge.getComponent(), schema, metadata, queryCommand);
                    selectorsByMethod.put(metadata.getMethod(), ejbSelectBridge);
                } catch (FinderException e) {
                    throw new RuntimeException(e);
                }
            }
View Full Code Here

        for (JDBCQueryMetaData metadata : queries) {
            if (metadata.getMethod().getName().startsWith("ejbSelect")) {
                try {
                    QueryCommand queryCommand = queryFactory.getQueryCommand(metadata.getMethod());
                    Schema schema = ((JDBCStoreManager2) entityBridge.getManager()).getSchema();
                    EJBSelectBridge ejbSelectBridge = new EJBSelectBridge((JDBCStoreManager2) entityBridge.getManager(), entityBridge.getComponent(), schema, metadata, queryCommand);
                    selectorsByMethod.put(metadata.getMethod(), ejbSelectBridge);
                } catch (FinderException e) {
                    throw new RuntimeException(e.getMessage());
                }
            }
View Full Code Here

        // UPDATE SQL
        updateSql = "update " + tableName + " set ";
        int setFields = 0;
        for (int i = 0; i < tableFields.length; ++i) {
            JDBCCMPFieldBridge2 field = tableFields[i];
            if (!field.isPrimaryKeyMember()) {
                if (setFields++ > 0) {
                    updateSql += ", ";
                }
                updateSql += field.getColumnName() + "=?";
            }
        }
        updateSql += " where ";
        updateSql += pkFields[0].getColumnName() + "=?";
        for (int i = 1; i < pkFields.length; ++i) {
            updateSql += " and " + pkFields[i].getColumnName() + "=?";
        }

        if (entity.getVersionField() != null) {
            updateSql += " and " + entity.getVersionField().getColumnName() + "=?";
        }
        log.debug("update sql: " + updateSql);

        // SELECT SQL
        String selectColumns = tableFields[0].getColumnName();
        for (int i = 1; i < tableFields.length; ++i) {
            JDBCCMPFieldBridge2 field = tableFields[i];
            selectColumns += ", " + field.getColumnName();
        }

        String whereColumns = pkFields[0].getColumnName() + "=?";
        for (int i = 1; i < pkFields.length; ++i) {
            whereColumns += " and " + pkFields[i].getColumnName() + "=?";
View Full Code Here

TOP

Related Classes of org.jboss.as.cmp.jdbc2.schema.EntityTable$Row

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.