Grokbase Groups Cayenne user May 2011
FAQ
Hi,

I'm using stable cayenne 3.0.1.

Following the tutorial in vertical inheritance i've been unable to make vertical inheritance work.

I've modified the tutorial app adding a Programmar as Child of Artist.

It have the following error:

Exception in thread "main" org.apache.cayenne.validation.ValidationException: [v.3.0.1 Sep 06 2010 15:09:38] Validation failures: Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
at org.apache.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:111)
at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1095)
at org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
at org.apache.cayenne.tutorial.Main.main(Main.java:48)

The code for creating a new Programmer in main is:

Programmer picasso = context.newObject(Programmer.class);
picasso.setTipo("P"); // Discriminator added in Artist
picasso.setName("Pablo Picasso");
picasso.setDateOfBirthString("18811025");

Any help will be appreciated.
Bye

Hans Poo, Welinux S.A.
Bombero Ossa #1010, oficina 526,
+56-2-3729770, Movil: +56-9-3199305
Santiago, Chile

Search Discussions

  • Andrus Adamchik at May 13, 2011 at 10:52 am
    Could you please post mapping XML? There were a few snags with vertical inheritance. Could be one of them.

    Andrus
    On May 12, 2011, at 8:10 PM, Hans C. Poo wrote:

    Hi,

    I'm using stable cayenne 3.0.1.

    Following the tutorial in vertical inheritance i've been unable to make vertical inheritance work.

    I've modified the tutorial app adding a Programmar as Child of Artist.

    It have the following error:

    Exception in thread "main" org.apache.cayenne.validation.ValidationException: [v.3.0.1 Sep 06 2010 15:09:38] Validation failures: Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    at org.apache.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:111)
    at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1095)
    at org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
    at org.apache.cayenne.tutorial.Main.main(Main.java:48)

    The code for creating a new Programmer in main is:

    Programmer picasso = context.newObject(Programmer.class);
    picasso.setTipo("P"); // Discriminator added in Artist
    picasso.setName("Pablo Picasso");
    picasso.setDateOfBirthString("18811025");

    Any help will be appreciated.
    Bye

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 526,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile

  • Hans C. Poo at May 13, 2011 at 4:06 pm
    Andrus,

    Thank you for your time, i modified a little bin
    cayenne-3.0.1/tutorials/tutorial

    The only modified file is UntitledDomainMap.map.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
    project-version="3.0.0.1">
    <property name="defaultPackage" value="org.apache.cayenne.tutorial.persistent"/>
    <db-entity name="ARTIST">
    <db-attribute name="DATE_OF_BIRTH" type="DATE"/>
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    <db-attribute name="TIPO" type="CHAR" isMandatory="true" length="1"/>
    </db-entity>
    <db-entity name="GALLERY">
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    </db-entity>
    <db-entity name="PAINTING">
    <db-attribute name="ARTIST_ID" type="INTEGER"/>
    <db-attribute name="GALLERY_ID" type="INTEGER"/>
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    </db-entity>
    <db-entity name="PROGRAMMER">
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="LANGUAGES" type="VARCHAR" length="256"/>
    </db-entity>
    <obj-entity name="Artist" className="org.apache.cayenne.tutorial.persistent.Artist" dbEntityName="ARTIST">
    <obj-attribute name="dateOfBirth" type="java.util.Date" db-attribute-path="DATE_OF_BIRTH"/>
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    <obj-attribute name="tipo" type="java.lang.String" db-attribute-path="TIPO"/>
    </obj-entity>
    <obj-entity name="Gallery" className="org.apache.cayenne.tutorial.persistent.Gallery" dbEntityName="GALLERY">
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    </obj-entity>
    <obj-entity name="Painting" className="org.apache.cayenne.tutorial.persistent.Painting" dbEntityName="PAINTING">
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    </obj-entity>
    <obj-entity name="Programmer" superEntityName="Artist" className="org.apache.cayenne.tutorial.persistent.Programmer" dbEntityName="PROGRAMMER">
    <qualifier><![CDATA[tipo = "P"]]></qualifier>
    <obj-attribute name="languages" type="java.lang.String" db-attribute-path="LANGUAGES"/>
    </obj-entity>
    <db-relationship name="paintings" source="ARTIST" target="PAINTING" toMany="true">
    <db-attribute-pair source="ID" target="ARTIST_ID"/>
    </db-relationship>
    <db-relationship name="programmer" source="ARTIST" target="PROGRAMMER" toDependentPK="true" toMany="false">
    <db-attribute-pair source="ID" target="ID"/>
    </db-relationship>
    <db-relationship name="paintings" source="GALLERY" target="PAINTING" toMany="true">
    <db-attribute-pair source="ID" target="GALLERY_ID"/>
    </db-relationship>
    <db-relationship name="artist" source="PAINTING" target="ARTIST" toMany="false">
    <db-attribute-pair source="ARTIST_ID" target="ID"/>
    </db-relationship>
    <db-relationship name="gallery" source="PAINTING" target="GALLERY" toMany="false">
    <db-attribute-pair source="GALLERY_ID" target="ID"/>
    </db-relationship>
    <db-relationship name="artist" source="PROGRAMMER" target="ARTIST" toMany="false">
    <db-attribute-pair source="ID" target="ID"/>
    </db-relationship>
    <obj-relationship name="paintings" source="Artist" target="Painting" deleteRule="Cascade" db-relationship-path="paintings"/>
    <obj-relationship name="programmer" source="Artist" target="Programmer" deleteRule="Nullify" db-relationship-path="programmer"/>
    <obj-relationship name="paintings" source="Gallery" target="Painting" deleteRule="Nullify" db-relationship-path="paintings"/>
    <obj-relationship name="artist" source="Painting" target="Artist" deleteRule="Nullify" db-relationship-path="artist"/>
    <obj-relationship name="gallery" source="Painting" target="Gallery" deleteRule="Nullify" db-relationship-path="gallery"/>
    <obj-relationship name="artist" source="Programmer" target="Artist" deleteRule="Nullify" db-relationship-path="artist"/>
    </data-map>

    Thanks
    Hans

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 800,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile


    ----- Mensaje original -----
    De: "Andrus Adamchik" <andrus@objectstyle.org>
    Para: user@cayenne.apache.org
    Enviados: Viernes, 13 de Mayo 2011 6:51:55
    Asunto: Re: Help or sample on vertical inheritance

    Could you please post mapping XML? There were a few snags with vertical inheritance. Could be one of them.

    Andrus
    On May 12, 2011, at 8:10 PM, Hans C. Poo wrote:

    Hi,

    I'm using stable cayenne 3.0.1.

    Following the tutorial in vertical inheritance i've been unable to make vertical inheritance work.

    I've modified the tutorial app adding a Programmar as Child of Artist.

    It have the following error:

    Exception in thread "main" org.apache.cayenne.validation.ValidationException: [v.3.0.1 Sep 06 2010 15:09:38] Validation failures: Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    at org.apache.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:111)
    at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1095)
    at org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
    at org.apache.cayenne.tutorial.Main.main(Main.java:48)

    The code for creating a new Programmer in main is:

    Programmer picasso = context.newObject(Programmer.class);
    picasso.setTipo("P"); // Discriminator added in Artist
    picasso.setName("Pablo Picasso");
    picasso.setDateOfBirthString("18811025");

    Any help will be appreciated.
    Bye

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 526,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile

  • Andrus Adamchik at May 18, 2011 at 11:55 pm
    Ok, here is a modified version of that DataMap that has vertical inheritance mapped correctly. Per http://cayenne.apache.org/doc30/modeling-vertical-inheritance.html v-inheritance in Cayenne is the same as single-table, only with flattened attributes to child tables. So the main change that I made was mapping Programmer to ARTIST table, and then flattenning "languages" attribute to "programmer.LANGUAGES".

    Also removed ObjRelationships between Artist and Programmer. That should be it.

    Sorry for delayed reply.

    Cheers,
    Andrus


    <?xml version="1.0" encoding="utf-8"?>
    <data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
    project-version="3.0.0.1">
    <property name="defaultPackage" value="org.apache.cayenne.tutorial.persistent"/>
    <db-entity name="ARTIST">
    <db-attribute name="DATE_OF_BIRTH" type="DATE"/>
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    <db-attribute name="TIPO" type="CHAR" isMandatory="true" length="1"/>
    </db-entity>
    <db-entity name="GALLERY">
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    </db-entity>
    <db-entity name="PAINTING">
    <db-attribute name="ARTIST_ID" type="INTEGER"/>
    <db-attribute name="GALLERY_ID" type="INTEGER"/>
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    </db-entity>
    <db-entity name="PROGRAMMER">
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="LANGUAGES" type="VARCHAR" length="256"/>
    </db-entity>
    <obj-entity name="Artist" className="org.apache.cayenne.tutorial.persistent.Artist" dbEntityName="ARTIST">
    <obj-attribute name="dateOfBirth" type="java.util.Date" db-attribute-path="DATE_OF_BIRTH"/>
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    <obj-attribute name="tipo" type="java.lang.String" db-attribute-path="TIPO"/>
    </obj-entity>
    <obj-entity name="Gallery" className="org.apache.cayenne.tutorial.persistent.Gallery" dbEntityName="GALLERY">
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    </obj-entity>
    <obj-entity name="Painting" className="org.apache.cayenne.tutorial.persistent.Painting" dbEntityName="PAINTING">
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    </obj-entity>
    <obj-entity name="Programmer" superEntityName="Artist" className="org.apache.cayenne.tutorial.persistent.Programmer" dbEntityName="ARTIST">
    <qualifier><![CDATA[tipo = "P"]]></qualifier>
    <obj-attribute name="languages" type="java.lang.String" db-attribute-path="programmer.LANGUAGES"/>
    </obj-entity>
    <db-relationship name="paintings" source="ARTIST" target="PAINTING" toMany="true">
    <db-attribute-pair source="ID" target="ARTIST_ID"/>
    </db-relationship>
    <db-relationship name="programmer" source="ARTIST" target="PROGRAMMER" toDependentPK="true" toMany="false">
    <db-attribute-pair source="ID" target="ID"/>
    </db-relationship>
    <db-relationship name="paintings" source="GALLERY" target="PAINTING" toMany="true">
    <db-attribute-pair source="ID" target="GALLERY_ID"/>
    </db-relationship>
    <db-relationship name="artist" source="PAINTING" target="ARTIST" toMany="false">
    <db-attribute-pair source="ARTIST_ID" target="ID"/>
    </db-relationship>
    <db-relationship name="gallery" source="PAINTING" target="GALLERY" toMany="false">
    <db-attribute-pair source="GALLERY_ID" target="ID"/>
    </db-relationship>
    <db-relationship name="artist" source="PROGRAMMER" target="ARTIST" toMany="false">
    <db-attribute-pair source="ID" target="ID"/>
    </db-relationship>
    <obj-relationship name="paintings" source="Artist" target="Painting" deleteRule="Cascade" db-relationship-path="paintings"/>
    <obj-relationship name="paintings" source="Gallery" target="Painting" deleteRule="Nullify" db-relationship-path="paintings"/>
    <obj-relationship name="artist" source="Painting" target="Artist" deleteRule="Nullify" db-relationship-path="artist"/>
    <obj-relationship name="gallery" source="Painting" target="Gallery" deleteRule="Nullify" db-relationship-path="gallery"/>
    </data-map>
  • Hans C. Poo at May 19, 2011 at 8:36 pm
    Andrus,

    Good, thanks it's working now.

    Besides following the indications in the manual, analysing your response i've
    noticed the following things that weren't obvious (for me) at first:

    - The child class must map to the parent table.
    In Child Entity in the Entity tab Table/View must be changed to the parent table.

    - Manually map attributes of the Child Entity to the Child Table
    When we map the Child Entity to use the Parent Table, the attributes
    of the Child are no longer present in the parent table, though, we must
    manually map every attribute of the Child Entity to its corresponding
    attribute in the Child Table, the problem is that the Modeler 3.0.1 doesn't include them
    in the Combo Box where you set DBAttribute, and this modification must be done
    manually in the XML Map file, the format is table.field.


    Bye
    Hans

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 800,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile


    ----- Mensaje original -----
    De: "Andrus Adamchik" <andrus@objectstyle.org>
    Para: user@cayenne.apache.org
    Enviados: Miércoles, 18 de Mayo 2011 19:55:26
    Asunto: Re: Help or sample on vertical inheritance

    Ok, here is a modified version of that DataMap that has vertical inheritance mapped correctly. Per http://cayenne.apache.org/doc30/modeling-vertical-inheritance.html v-inheritance in Cayenne is the same as single-table, only with flattened attributes to child tables. So the main change that I made was mapping Programmer to ARTIST table, and then flattenning "languages" attribute to "programmer.LANGUAGES".

    Also removed ObjRelationships between Artist and Programmer. That should be it.

    Sorry for delayed reply.

    Cheers,
    Andrus


    <?xml version="1.0" encoding="utf-8"?>
    <data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
    project-version="3.0.0.1">
    <property name="defaultPackage" value="org.apache.cayenne.tutorial.persistent"/>
    <db-entity name="ARTIST">
    <db-attribute name="DATE_OF_BIRTH" type="DATE"/>
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    <db-attribute name="TIPO" type="CHAR" isMandatory="true" length="1"/>
    </db-entity>
    <db-entity name="GALLERY">
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    </db-entity>
    <db-entity name="PAINTING">
    <db-attribute name="ARTIST_ID" type="INTEGER"/>
    <db-attribute name="GALLERY_ID" type="INTEGER"/>
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="NAME" type="VARCHAR" length="200"/>
    </db-entity>
    <db-entity name="PROGRAMMER">
    <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
    <db-attribute name="LANGUAGES" type="VARCHAR" length="256"/>
    </db-entity>
    <obj-entity name="Artist" className="org.apache.cayenne.tutorial.persistent.Artist" dbEntityName="ARTIST">
    <obj-attribute name="dateOfBirth" type="java.util.Date" db-attribute-path="DATE_OF_BIRTH"/>
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    <obj-attribute name="tipo" type="java.lang.String" db-attribute-path="TIPO"/>
    </obj-entity>
    <obj-entity name="Gallery" className="org.apache.cayenne.tutorial.persistent.Gallery" dbEntityName="GALLERY">
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    </obj-entity>
    <obj-entity name="Painting" className="org.apache.cayenne.tutorial.persistent.Painting" dbEntityName="PAINTING">
    <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
    </obj-entity>
    <obj-entity name="Programmer" superEntityName="Artist" className="org.apache.cayenne.tutorial.persistent.Programmer" dbEntityName="ARTIST">
    <qualifier><![CDATA[tipo = "P"]]></qualifier>
    <obj-attribute name="languages" type="java.lang.String" db-attribute-path="programmer.LANGUAGES"/>
    </obj-entity>
    <db-relationship name="paintings" source="ARTIST" target="PAINTING" toMany="true">
    <db-attribute-pair source="ID" target="ARTIST_ID"/>
    </db-relationship>
    <db-relationship name="programmer" source="ARTIST" target="PROGRAMMER" toDependentPK="true" toMany="false">
    <db-attribute-pair source="ID" target="ID"/>
    </db-relationship>
    <db-relationship name="paintings" source="GALLERY" target="PAINTING" toMany="true">
    <db-attribute-pair source="ID" target="GALLERY_ID"/>
    </db-relationship>
    <db-relationship name="artist" source="PAINTING" target="ARTIST" toMany="false">
    <db-attribute-pair source="ARTIST_ID" target="ID"/>
    </db-relationship>
    <db-relationship name="gallery" source="PAINTING" target="GALLERY" toMany="false">
    <db-attribute-pair source="GALLERY_ID" target="ID"/>
    </db-relationship>
    <db-relationship name="artist" source="PROGRAMMER" target="ARTIST" toMany="false">
    <db-attribute-pair source="ID" target="ID"/>
    </db-relationship>
    <obj-relationship name="paintings" source="Artist" target="Painting" deleteRule="Cascade" db-relationship-path="paintings"/>
    <obj-relationship name="paintings" source="Gallery" target="Painting" deleteRule="Nullify" db-relationship-path="paintings"/>
    <obj-relationship name="artist" source="Painting" target="Artist" deleteRule="Nullify" db-relationship-path="artist"/>
    <obj-relationship name="gallery" source="Painting" target="Gallery" deleteRule="Nullify" db-relationship-path="gallery"/>
    </data-map>
  • Hans C. Poo at May 17, 2011 at 3:16 pm
    Andrus,

    ¿ Did you found something strange in the map ? or ¿ do you have any working sample that i can adapt ?

    Thank you
    Hans

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 800,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile


    ----- Mensaje original -----
    De: "Andrus Adamchik" <andrus@objectstyle.org>
    Para: user@cayenne.apache.org
    Enviados: Viernes, 13 de Mayo 2011 6:51:55
    Asunto: Re: Help or sample on vertical inheritance

    Could you please post mapping XML? There were a few snags with vertical inheritance. Could be one of them.

    Andrus
    On May 12, 2011, at 8:10 PM, Hans C. Poo wrote:

    Hi,

    I'm using stable cayenne 3.0.1.

    Following the tutorial in vertical inheritance i've been unable to make vertical inheritance work.

    I've modified the tutorial app adding a Programmar as Child of Artist.

    It have the following error:

    Exception in thread "main" org.apache.cayenne.validation.ValidationException: [v.3.0.1 Sep 06 2010 15:09:38] Validation failures: Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    at org.apache.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:111)
    at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1095)
    at org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
    at org.apache.cayenne.tutorial.Main.main(Main.java:48)

    The code for creating a new Programmer in main is:

    Programmer picasso = context.newObject(Programmer.class);
    picasso.setTipo("P"); // Discriminator added in Artist
    picasso.setName("Pablo Picasso");
    picasso.setDateOfBirthString("18811025");

    Any help will be appreciated.
    Bye

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 526,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile

  • Andrus Adamchik at May 17, 2011 at 3:20 pm
    Hi Hans,

    I saw your message. Sorry didn't have time to try out the mapping yet.

    Andrus
    On May 17, 2011, at 11:17 AM, Hans C. Poo wrote:

    Andrus,

    ¿ Did you found something strange in the map ? or ¿ do you have any working sample that i can adapt ?

    Thank you
    Hans

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 800,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile


    ----- Mensaje original -----
    De: "Andrus Adamchik" <andrus@objectstyle.org>
    Para: user@cayenne.apache.org
    Enviados: Viernes, 13 de Mayo 2011 6:51:55
    Asunto: Re: Help or sample on vertical inheritance

    Could you please post mapping XML? There were a few snags with vertical inheritance. Could be one of them.

    Andrus
    On May 12, 2011, at 8:10 PM, Hans C. Poo wrote:

    Hi,

    I'm using stable cayenne 3.0.1.

    Following the tutorial in vertical inheritance i've been unable to make vertical inheritance work.

    I've modified the tutorial app adding a Programmar as Child of Artist.

    It have the following error:

    Exception in thread "main" org.apache.cayenne.validation.ValidationException: [v.3.0.1 Sep 06 2010 15:09:38] Validation failures: Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    Validation failure for org.apache.cayenne.tutorial.persistent.Programmer.artist: "artist" is required.
    at org.apache.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:111)
    at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1095)
    at org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
    at org.apache.cayenne.tutorial.Main.main(Main.java:48)

    The code for creating a new Programmer in main is:

    Programmer picasso = context.newObject(Programmer.class);
    picasso.setTipo("P"); // Discriminator added in Artist
    picasso.setName("Pablo Picasso");
    picasso.setDateOfBirthString("18811025");

    Any help will be appreciated.
    Bye

    Hans Poo, Welinux S.A.
    Bombero Ossa #1010, oficina 526,
    +56-2-3729770, Movil: +56-9-3199305
    Santiago, Chile

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedMay 12, '11 at 5:10p
activeMay 19, '11 at 8:36p
posts7
users2
websitecayenne.apache.org

2 users in discussion

Hans C. Poo: 4 posts Andrus Adamchik: 3 posts

People

Translate

site design / logo © 2022 Grokbase