[jira] Created: (CAY-1057) Propagation of Dependent non-PK value doesn't work

From: Scott Anderson (JIRA) ("Scott)
Date: Fri May 16 2008 - 11:57:52 EDT

  • Next message: Scott Anderson (JIRA): "[jira] Commented: (CAY-1057) Propagation of Dependent non-PK value doesn't work"

    Propagation of Dependent non-PK value doesn't work
    --------------------------------------------------

                     Key: CAY-1057
                     URL: https://issues.apache.org/cayenne/browse/CAY-1057
                 Project: Cayenne
              Issue Type: Bug
              Components: Cayenne Core Library
        Affects Versions: 3.0
             Environment: cayenne-jdk1.5-unpublished-3.0-SNAPSHOT.jar (tested with Hudson build 137)
                Reporter: Scott Anderson
                Assignee: Andrus Adamchik

    `command`
            `id` int PK
            `name` varchar(32) UNIQUE

    `command_alias`
            `alias` varchar(32) PK
            `name` varchar(32) FK REF `command`.`name`

            <db-entity name="command">
                    <db-attribute name="id" type="INTEGER"
    isPrimaryKey="true" isGenerated="true" isMandatory="true" length="11"/>
                    <db-attribute name="name" type="VARCHAR"
    isMandatory="true" length="32"/>
            </db-entity>
            <db-entity name="command_alias">
                    <db-attribute name="alias" type="VARCHAR"
    isPrimaryKey="true" isMandatory="true" length="32"/>
                    <db-attribute name="name" type="VARCHAR" length="32"/>
            </db-entity>
            <obj-entity name="Command" className="net.bnubot.db.Command"
    dbEntityName="command" superClassName="net.bnubot.db.CustomDataObject">
                    <obj-attribute name="name" type="java.lang.String"
    db-attribute-path="name"/>
            </obj-entity>
            <obj-entity name="CommandAlias"
    className="net.bnubot.db.CommandAlias" dbEntityName="command_alias"
    superClassName="net.bnubot.db.CustomDataObject">
                    <obj-attribute name="alias" type="java.lang.String"
    db-attribute-path="alias"/>
            </obj-entity>
            <db-relationship name="commandAliasArray" source="command"
    target="command_alias" toMany="true">
                    <db-attribute-pair source="name" target="name"/>
            </db-relationship>
            <db-relationship name="toCommand" source="command_alias"
    target="command" toMany="false">
                    <db-attribute-pair source="name" target="name"/>
            </db-relationship>
            <obj-relationship name="aliases" source="Command"
    target="CommandAlias" deleteRule="Deny"
    db-relationship-path="commandAliasArray"/>
            <obj-relationship name="toCommand" source="CommandAlias"
    target="Command" db-relationship-path="toCommand"/>

            public static CommandAlias create(Command command, String alias) {
                    CommandAlias ca =
    DatabaseContext.getContext().newObject(CommandAlias.class);
                    ca.setAlias(alias);
                    ca.setToCommand(command);
                    command.addToAliases(ca);
                    try {
                            ca.updateRow();
                            return ca;
                    } catch(Exception e) {
                            Out.exception(e);
                            return null;
                    }
            }

    May 12, 2008 6:15:55 PM org.apache.cayenne.access.QueryLogger logQuery
    INFO: INSERT INTO command_alias (alias, name) VALUES (?, ?)
    INFO: [batch bind: 1->alias:'aa', 2->name:NULL] May 12, 2008 6:15:55 PM org.apache.cayenne.access.QueryLogger
    logQueryError
    INFO: *** error.
    java.sql.SQLIntegrityConstraintViolationException: Column 'NAME' cannot accept a NULL value.

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Fri May 16 2008 - 11:58:18 EDT