cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: To-Many Warning?
Date Thu, 14 Nov 2013 14:37:11 GMT
Can you also check that the Fk and Pk columns are the same type?  MySQL
requires this and if you mismatch Integer and BigInt it doesn't work.

John

On Thursday, November 14, 2013, Michael Gentry wrote:

> I'll create a JIRA for it later.  I think it should also include a warning
> to check for to-one in both directions, also (unless To-Dep is checked).
>
>
> On Thu, Nov 14, 2013 at 2:47 AM, Andrus Adamchik <andrus@objectstyle.org<javascript:;>
> >wrote:
>
> > > Should Cayenne Modeler give a warning when both sides are to-many
> > > (and not a flattened many-to-many)?
> >
> > I think it should.
> >
> > A.
> >
> > On Nov 13, 2013, at 8:20 PM, Michael Gentry <mgentry@masslight.net<javascript:;>>
> wrote:
> >
> > > I just spent a couple hours debugging an issue where the model was
> messed
> > > up and the to-many checkbox (in the DbEntity editors) was set on both
> > sides
> > > of a relationship and Cayenne was inserting NULLs for the FK and
> > orphaning
> > > records.  Should Cayenne Modeler give a warning when both sides are
> > to-many
> > > (and not a flattened many-to-many)?
> > >
> > > Here is the XML for the issue (using 3.1B2, but the issue exists in
> 3.0.2
> > > also):
> > >
> > > ~> cat cayenne-project.xml
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <domain project-version="6">
> > > <map name="datamap"/>
> > > </domain>
> > >
> > >
> > > ~> cat datamap.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="6">
> > > <db-entity name="child">
> > > <db-attribute name="parent_fk" type="BIGINT"/>
> > > <db-attribute name="pk" type="BIGINT" isPrimaryKey="true"
> > > isMandatory="true"/>
> > > </db-entity>
> > > <db-entity name="parent">
> > > <db-attribute name="pk" type="BIGINT" isPrimaryKey="true"
> > > isMandatory="true"/>
> > > </db-entity>
> > > <db-relationship name="to_parent" source="child" target="parent"
> > > toMany="true">
> > > <db-attribute-pair source="parent_fk" target="pk"/>
> > > </db-relationship>
> > > <db-relationship name="to_child" source="parent" target="child"
> > > toMany="true">
> > > <db-attribute-pair source="pk" target="parent_fk"/>
> > > </db-relationship>
> > > </data-map>
> > >
> > >
> > > Thanks,
> > >
> > > mrg
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message