Problem by Updating an Object

From: Kai Michael Bodach (kai.michael.bodac..ondat.de)
Date: Tue Feb 10 2004 - 06:34:25 EST

  • Next message: Stephen Adams: "Openbase"

    Hi Cayenne users,

    I have a strange problem when I'm using cayenne. I'm a newbie and the cause
    could be the configuration or the way I use cayenne. What I try, is to
    update a exist Object (I think the right term is ObjEntity???). Ok, I have
    load the object via SelectQuery from the db (oracle). I got my object
    (CayenneDataObject) and cast it to my Type. Then I use the setMethod to
    change a property, e.g. a discription property (String). So far so good.
    When I now commit my changes, via dataContext.commitChanges(), I got the
    following Exception:
    org.objectstyle.cayenne.CayenneRuntimeException
    [v.1.0.6 January 26 2004] Class
    'de.mmicha.poc.resourcemanager.db.cy.CYDbRecht' does not map to an ObjEntity
    and is therefore not persistent. Can't commit changes.

    So, I have checked my configuration at runtime and I tryed to figured out
    what map are there. I take the context and called the getDataMaps()-Method
    and I've got the right DataMap (I've checked the name via map.getName()).
    Then I called the getObjectEntityMap() and logged all out, the ClassName,
    the JavaClass and the Name. All seems to be ok. It exists a ObjEntity with
    the name "WopRecht", the class of this entity is
    "de.mmicha.poc.resourcemanager.db.cy.CYDbRecht", the super class is
    "de.mmicha.poc.resourcemanager.db.cy.CYDbObject" ... let say it again it
    seems all ok. But why can't cayenne find the map to my ObjEntity ??? I hope
    anybody can help and pull me out of my confusion, I really checked all, I
    don't know what it can be. Here is a snippet of my map file:

    [SNIPPET-BEGIN]

    <?xml version="1.0" encoding="utf-8"?>
    <data-map project-version="1.0">
            ...
            <db-entity name="WOP_RECHT">
                    <db-attribute name="ACCESS_RIGHT_CLASS" type="VARCHAR"
    length="200"/>
                    <db-attribute name="BESCHR_RECHT" type="VARCHAR"
    length="1000"/>
                    <db-attribute name="BEZ_RECHT" type="VARCHAR" length="100"/>
                    <db-attribute name="ID_DIENSTTYP" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="22"/>
                    <db-attribute name="ID_RECHT" type="INTEGER"
    isMandatory="true" length="22"/>
                    <db-attribute name="ID_RESOURCE" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="22"/>
                    <db-attribute name="P_ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true" length="22"/>
                    <db-attribute name="RECHTE_FLAG" type="INTEGER"
    length="22"/>
            </db-entity>
            ...
            <obj-entity name="WopRecht"
    className="de.mmicha.poc.resourcemanager.db.cy.CYDbRecht"
    dbEntityName="WOP_RECHT"
    superClassName="de.mmicha.poc.resourcemanager.db.cy.CYDbObject">
                    <obj-attribute name="accessRightClass"
    type="java.lang.String" db-attribute-path="ACCESS_RIGHT_CLASS"/>
                    <obj-attribute name="beschrRecht" type="java.lang.String"
    db-attribute-path="BESCHR_RECHT"/>
                    <obj-attribute name="bezRecht" type="java.lang.String"
    db-attribute-path="BEZ_RECHT"/>
                    <obj-attribute name="idRecht" type="java.lang.Integer"
    db-attribute-path="ID_RECHT"/>
                    <obj-attribute name="rechteFlag" type="java.lang.Integer"
    db-attribute-path="RECHTE_FLAG"/>
            </obj-entity>
            ...
            <db-relationship name="toWopDiensttyp" source="WOP_RECHT"
    target="WOP_DIENSTTYP" toDependentPK="false"
    toMany="false">
                    <db-attribute-pair source="ID_DIENSTTYP"
    target="ID_DIENSTTYP"/>
            </db-relationship>
            <db-relationship name="toWopGroup" source="WOP_RECHT"
    target="WOP_GROUP" toDependentPK="false" toMany="false">
                    <db-attribute-pair source="P_ID" target="P_ID"/>
            </db-relationship>
            <db-relationship name="toWopRessource" source="WOP_RECHT"
    target="WOP_RESSOURCE" toDependentPK="false" toMany="false">
                    <db-attribute-pair source="ID_RESOURCE"
    target="ID_RESOURCE"/>
            </db-relationship>
            ...
            <obj-relationship name="toWopDiensttyp" source="WopRecht"
    target="WopDiensttyp" toMany="false">
                    <db-relationship-ref source="WOP_RECHT"
    target="WOP_DIENSTTYP" name="toWopDiensttyp"/>
            </obj-relationship>
            <obj-relationship name="toWopGroup" source="WopRecht"
    target="WopGroup" toMany="false">
                    <db-relationship-ref source="WOP_RECHT" target="WOP_GROUP"
    name="toWopGroup"/>
            </obj-relationship>
            <obj-relationship name="toWopRessource" source="WopRecht"
    target="WopRessource" toMany="false">
                    <db-relationship-ref source="WOP_RECHT"
    target="WOP_RESSOURCE" name="toWopRessource"/>
            </obj-relationship>
            ...
    </data-map>

    [SNIPPET-END]

    -kai



    This archive was generated by hypermail 2.0.0 : Tue Feb 10 2004 - 06:36:01 EST