Package org.jboss.as.cmp.jdbc.metadata

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData


    private void loadCMRFields(JDBCEntityMetaData metadata) {
        cmrFields = new JDBCCMRFieldBridge[metadata.getRelationshipRoles().size()];
        // create each field
        int cmrFieldIndex = 0;
        for (Iterator iter = metadata.getRelationshipRoles().iterator(); iter.hasNext(); ) {
            JDBCRelationshipRoleMetaData relationshipRole = (JDBCRelationshipRoleMetaData) iter.next();
            JDBCCMRFieldBridge cmrField = new JDBCCMRFieldBridge(this, manager, relationshipRole);
            cmrFields[cmrFieldIndex++] = cmrField;
        }
    }
View Full Code Here


        }
    }

    public static CascadeDeleteStrategy getCascadeDeleteStrategy(JDBCCMRFieldBridge cmrField) {
        CascadeDeleteStrategy result;
        JDBCRelationshipRoleMetaData relatedRole = cmrField.getMetaData().getRelatedRole();
        if (relatedRole.isBatchCascadeDelete()) {
            result = new BatchCascadeDeleteStrategy(cmrField);
        } else if (relatedRole.isCascadeDelete()) {
            result = new DefaultCascadeDeleteStrategy(cmrField);
        } else {
            result = new NoneCascadeDeleteStrategy(cmrField);
        }
        return result;
View Full Code Here

    private void loadCMRFields(JDBCEntityMetaData metadata) {
        cmrFields = new JDBCCMRFieldBridge[metadata.getRelationshipRoles().size()];
        // create each field
        int cmrFieldIndex = 0;
        for (Iterator iter = metadata.getRelationshipRoles().iterator(); iter.hasNext(); ) {
            JDBCRelationshipRoleMetaData relationshipRole = (JDBCRelationshipRoleMetaData) iter.next();
            JDBCCMRFieldBridge cmrField = new JDBCCMRFieldBridge(this, manager, relationshipRole);
            cmrFields[cmrFieldIndex++] = cmrField;
        }
    }
View Full Code Here

        sql.append(')');
        return sql.toString();
    }

    private void addForeignKeyConstraint(JDBCAbstractCMRFieldBridge cmrField) {
        JDBCRelationshipRoleMetaData metaData = cmrField.getMetaData();
        if (metaData.hasForeignKeyConstraint()) {
            if (metaData.getRelationMetaData().isTableMappingStyle()) {
                addForeignKeyConstraint(manager.getDataSource(metaData.getRelationMetaData().getDataSourceName()), // TODO: jeb - get datasource
                        cmrField.getQualifiedTableName(),
                        cmrField.getFieldName(),
                        cmrField.getTableKeyFields(),
                        cmrField.getEntity().getQualifiedTableName(),
                        cmrField.getEntity().getPrimaryKeyFields());

            } else if (cmrField.hasForeignKey()) {
                JDBCAbstractEntityBridge relatedEntity = (JDBCAbstractEntityBridge) cmrField.getRelatedEntity();
                addForeignKeyConstraint(cmrField.getEntity().getDataSource(),
                        cmrField.getEntity().getQualifiedTableName(),
                        cmrField.getFieldName(),
                        cmrField.getForeignKeyFields(),
                        relatedEntity.getQualifiedTableName(),
                        relatedEntity.getPrimaryKeyFields());
            }
        } else {
            log.debug("Foreign key constraint not added as requested: relationshipRolename=" + metaData.getRelationshipRoleName());
        }
    }
View Full Code Here

    private void loadCMRFields(JDBCEntityMetaData metadata) {
        cmrFields = new JDBCCMRFieldBridge2[metadata.getRelationshipRoles().size()];
        // create each field
        int cmrFieldIndex = 0;
        for (Iterator iter = metadata.getRelationshipRoles().iterator(); iter.hasNext(); ) {
            JDBCRelationshipRoleMetaData relationshipRole = (JDBCRelationshipRoleMetaData) iter.next();
            JDBCCMRFieldBridge2 cmrField = new JDBCCMRFieldBridge2(this, manager, relationshipRole);
            cmrFields[cmrFieldIndex++] = cmrField;
        }
    }
View Full Code Here

    private void loadCMRFields(JDBCEntityMetaData metadata) {
        cmrFields = new JDBCCMRFieldBridge[metadata.getRelationshipRoles().size()];
        // create each field
        int cmrFieldIndex = 0;
        for (Iterator iter = metadata.getRelationshipRoles().iterator(); iter.hasNext(); ) {
            JDBCRelationshipRoleMetaData relationshipRole = (JDBCRelationshipRoleMetaData) iter.next();
            JDBCCMRFieldBridge cmrField = new JDBCCMRFieldBridge(this, manager, relationshipRole);
            cmrFields[cmrFieldIndex++] = cmrField;
        }
    }
View Full Code Here

        }
    }

    public static CascadeDeleteStrategy getCascadeDeleteStrategy(JDBCCMRFieldBridge cmrField) {
        CascadeDeleteStrategy result;
        JDBCRelationshipRoleMetaData relatedRole = cmrField.getMetaData().getRelatedRole();
        if (relatedRole.isBatchCascadeDelete()) {
            result = new BatchCascadeDeleteStrategy(cmrField);
        } else if (relatedRole.isCascadeDelete()) {
            result = new DefaultCascadeDeleteStrategy(cmrField);
        } else {
            result = new NoneCascadeDeleteStrategy(cmrField);
        }
        return result;
View Full Code Here

        }
    }

    public static CascadeDeleteStrategy getCascadeDeleteStrategy(JDBCCMRFieldBridge cmrField) {
        CascadeDeleteStrategy result;
        JDBCRelationshipRoleMetaData relatedRole = cmrField.getMetaData().getRelatedRole();
        if (relatedRole.isBatchCascadeDelete()) {
            result = new BatchCascadeDeleteStrategy(cmrField);
        } else if (relatedRole.isCascadeDelete()) {
            result = new DefaultCascadeDeleteStrategy(cmrField);
        } else {
            result = new NoneCascadeDeleteStrategy(cmrField);
        }
        return result;
View Full Code Here

        sql.append(')');
        return sql.toString();
    }

    private void addForeignKeyConstraint(JDBCAbstractCMRFieldBridge cmrField) {
        JDBCRelationshipRoleMetaData metaData = cmrField.getMetaData();
        if (metaData.hasForeignKeyConstraint()) {
            if (metaData.getRelationMetaData().isTableMappingStyle()) {
                addForeignKeyConstraint(manager.getDataSource(metaData.getRelationMetaData().getDataSourceName()), // TODO: jeb - get datasource
                        cmrField.getQualifiedTableName(),
                        cmrField.getFieldName(),
                        cmrField.getTableKeyFields(),
                        cmrField.getEntity().getQualifiedTableName(),
                        cmrField.getEntity().getPrimaryKeyFields());

            } else if (cmrField.hasForeignKey()) {
                JDBCAbstractEntityBridge relatedEntity = (JDBCAbstractEntityBridge) cmrField.getRelatedEntity();
                addForeignKeyConstraint(cmrField.getEntity().getDataSource(),
                        cmrField.getEntity().getQualifiedTableName(),
                        cmrField.getFieldName(),
                        cmrField.getForeignKeyFields(),
                        relatedEntity.getQualifiedTableName(),
                        relatedEntity.getPrimaryKeyFields());
            }
        } else {
            log.debug("Foreign key constraint not added as requested: relationshipRolename=" + metaData.getRelationshipRoleName());
        }
    }
View Full Code Here

    private void loadCMRFields(JDBCEntityMetaData metadata) {
        cmrFields = new JDBCCMRFieldBridge2[metadata.getRelationshipRoles().size()];
        // create each field
        int cmrFieldIndex = 0;
        for (Iterator iter = metadata.getRelationshipRoles().iterator(); iter.hasNext(); ) {
            JDBCRelationshipRoleMetaData relationshipRole = (JDBCRelationshipRoleMetaData) iter.next();
            JDBCCMRFieldBridge2 cmrField = new JDBCCMRFieldBridge2(this, manager, relationshipRole);
            cmrFields[cmrFieldIndex++] = cmrField;
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData

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.