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

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


        return parsedCmpField;
    }

    private static JDBCEntityCommandMetaData parseEntityCommand(final XMLStreamReader reader, final ClassLoader classLoader) throws XMLStreamException {

        final JDBCEntityCommandMetaData metaData = new JDBCEntityCommandMetaData();

        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case NAME: {
                    metaData.setName(reader.getAttributeValue(i));
                    break;
                }
                case CLASS: {
                    final String command = reader.getAttributeValue(i);
                    try {
                        metaData.setClass(classLoader.loadClass(command));
                    } catch (ClassNotFoundException e) {
                        throw MESSAGES.failedToLoadEntityCommand(command, e);
                    }
                    break;
                }
View Full Code Here


        bridgeInvocationHandler = new EntityBridgeInvocationHandler(createFieldMap(entityBridge), createSelectorMap(entityBridge, queryFactory));

        startCmd = new JDBCStartCommand(this);
        startCmd.execute();

        final JDBCEntityCommandMetaData entityCommand = getMetaData().getEntityCommand();
        if (entityCommand == null || "default".equals(entityCommand.getCommandName())) {
            createCmd = new ApplicationPkCreateCommand();
        } else {
            final Class cmdClass = entityCommand.getCommandClass();
            if (cmdClass == null) {
                throw CmpMessages.MESSAGES.entityCommandClassNotSpecified(entityBridge.getEntityName());
            }

            try {
View Full Code Here

        if (pkFields.length > 1) {
            throw CmpMessages.MESSAGES.entityCommandCanNotBeUsedWithCompositePk();
        }
        this.pkField = (JDBCCMPFieldBridge2) pkFields[0];

        JDBCEntityCommandMetaData metadata = entityBridge.getMetaData().getEntityCommand();
        pkSql = metadata.getAttribute("pk-sql");
        if (pkSql == null) {
            throw CmpMessages.MESSAGES.pkSqlAttributeNotSet(entityBridge.getEntityName());
        }
        if (log.isDebugEnabled()) {
            log.debug("entity-command generate pk sql: " + pkSql);
View Full Code Here

            }
        }

        initGeneratedFields();

        JDBCEntityCommandMetaData entityCommand = manager.getMetaData().getEntityCommand();
        if (entityCommand == null) {
            throw MESSAGES.entityCommandIsNull();
        }
        initEntityCommand(entityCommand);
View Full Code Here

        bridgeInvocationHandler = new EntityBridgeInvocationHandler(createFieldMap(entityBridge), createSelectorMap(entityBridge, queryFactory));

        startCmd = new JDBCStartCommand(this);
        startCmd.execute();

        final JDBCEntityCommandMetaData entityCommand = getMetaData().getEntityCommand();
        if (entityCommand == null || "default".equals(entityCommand.getCommandName())) {
            createCmd = new ApplicationPkCreateCommand();
        } else {
            final Class cmdClass = entityCommand.getCommandClass();
            if (cmdClass == null) {
                throw new RuntimeException(
                        "entity-command class name is not specified for entity " + entityBridge.getEntityName()
                );
            }
View Full Code Here

            }
        }

        initGeneratedFields();

        JDBCEntityCommandMetaData entityCommand = manager.getMetaData().getEntityCommand();
        if (entityCommand == null) {
            throw new RuntimeException("entity-command is null");
        }
        initEntityCommand(entityCommand);
View Full Code Here

    }

    public JDBCCreateCommand createCreateEntityCommand() {
        JDBCCreateCommand cec;
        try {
            JDBCEntityCommandMetaData commandMetaData = manager.getMetaData().getEntityCommand();
            if(commandMetaData.getCommandClass() == null) {
                commandMetaData = manager.getMetaData().getJDBCApplication().getEntityCommandByName(commandMetaData.getCommandName());
            }
            cec = (JDBCCreateCommand) commandMetaData.getCommandClass().newInstance();
            cec.init(manager);
        } catch (Exception e) {
            throw new RuntimeException("Couldn't create entity command: ", e);
        }
View Full Code Here

        return parsedCmpField;
    }

    private static JDBCEntityCommandMetaData parseEntityCommand(final XMLStreamReader reader, final ClassLoader classLoader) throws XMLStreamException {

        final JDBCEntityCommandMetaData metaData = new JDBCEntityCommandMetaData();

        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case NAME: {
                    metaData.setName(reader.getAttributeValue(i));
                    break;
                }
                case CLASS: {
                    try {
                        metaData.setClass(classLoader.loadClass(reader.getAttributeValue(i)));
                    } catch (ClassNotFoundException e) {
                        throw new RuntimeException("Failed to load entity command class", e);
                    }

                    break;
View Full Code Here

        bridgeInvocationHandler = new EntityBridgeInvocationHandler(createFieldMap(entityBridge), createSelectorMap(entityBridge, queryFactory));

        startCmd = new JDBCStartCommand(this);
        startCmd.execute();

        final JDBCEntityCommandMetaData entityCommand = getMetaData().getEntityCommand();
        if (entityCommand == null || "default".equals(entityCommand.getCommandName())) {
            createCmd = new ApplicationPkCreateCommand();
        } else {
            final Class cmdClass = entityCommand.getCommandClass();
            if (cmdClass == null) {
                throw new RuntimeException(
                        "entity-command class name is not specified for entity " + entityBridge.getEntityName()
                );
            }
View Full Code Here

        if (pkFields.length > 1) {
            throw new RuntimeException("This entity-command cannot be used with composite primary keys!");
        }
        this.pkField = (JDBCCMPFieldBridge2) pkFields[0];

        JDBCEntityCommandMetaData metadata = entityBridge.getMetaData().getEntityCommand();
        pkSql = metadata.getAttribute("pk-sql");
        if (pkSql == null) {
            throw new RuntimeException("pk-sql attribute must be set for entity " + entityBridge.getEntityName());
        }
        if (log.isDebugEnabled()) {
            log.debug("entity-command generate pk sql: " + pkSql);
View Full Code Here

TOP

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

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.