Unable to generate addTo... and removeFrom... methods

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to generate addTo... and removeFrom... methods

Mike Kienenberger
I'm trying to set up some flattened relationships in a new project and
data map using the modeler, and I'm having some problems.

Generated classes (from the modeler) isn't creating the addTo... and
removeFrom... methods.  Actually, neither is running it from the ant
cgen task.

My other project has similar relationships (although I can't remember
if I made the join table with dependent primary keys) and the methods
are generating without problem.

-Mike


<?xml version="1.0" encoding="utf-8"?>
<data-map project-version="1.1">
        <property name="defaultLockType" value="optimistic"/>
        <property name="defaultPackage" value="com.gvea.announcement.entity"/>
        <property name="defaultSuperclass" value="com.gvea.cayenne.BaseDataObject"/>
        <db-entity name="ANNOUNCEMENT">
                <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
isPrimaryKey="true" isMandatory="true"/>
[...]
        </db-entity>
        <db-entity name="ANNOUNCEMENT__CONTENT">
                <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
isPrimaryKey="true" isMandatory="true"/>
                <db-attribute name="CONTENT_ID" type="NUMERIC" isPrimaryKey="true"
isMandatory="true"/>
        </db-entity>
        <db-entity name="CONTENT">
                <db-attribute name="CONTENT_ID" type="NUMERIC" isPrimaryKey="true"
isMandatory="true"/>
[...]
        </db-entity>

        <obj-entity name="Announcement"
className="com.gvea.announcement.entity.Announcement"
lock-type="optimistic" dbEntityName="ANNOUNCEMENT"
superClassName="com.gvea.cayenne.BaseDataObject">
[...]
        </obj-entity>
        <obj-entity name="Content"
className="com.gvea.announcement.entity.Content"
lock-type="optimistic" dbEntityName="CONTENT"
superClassName="com.gvea.cayenne.BaseDataObject">
[...]
        </obj-entity>

        <db-relationship name="contentJoinList" source="ANNOUNCEMENT"
target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
                <db-attribute-pair source="ANNOUNCEMENT_ID" target="ANNOUNCEMENT_ID"/>
        </db-relationship>

        <db-relationship name="announcementList"
source="ANNOUNCEMENT__CONTENT" target="ANNOUNCEMENT" toMany="true">
                <db-attribute-pair source="ANNOUNCEMENT_ID" target="ANNOUNCEMENT_ID"/>
        </db-relationship>

        <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
target="CONTENT" toMany="true">
                <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
        </db-relationship>

        <db-relationship name="announcementList"
source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
                <db-attribute-pair source="ANNOUNCEMENT_ID" target="ANNOUNCEMENT_ID"/>
        </db-relationship>


        <db-relationship name="announcementJoinList" source="CONTENT"
target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
                <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
        </db-relationship>

        <obj-relationship name="contentList" source="Announcement"
target="Content" deleteRule="Cascade"
db-relationship-path="contentJoinList.contentList"/>

</data-map>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Andrus Adamchik
Mike, the reason for that is that relationship is treated as read-
only. Maybe because these two relationships FROM a join table are  
marked as to-many while they should be to-one?

Andrus


> <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> target="CONTENT" toMany="true">
>         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
>     </db-relationship>
>
>     <db-relationship name="announcementList"
> source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
>         <db-attribute-pair source="ANNOUNCEMENT_ID"  
> target="ANNOUNCEMENT_ID"/>
>     </db-relationship>





On Aug 31, 2005, at 12:27 PM, Mike Kienenberger wrote:

> I'm trying to set up some flattened relationships in a new project and
> data map using the modeler, and I'm having some problems.
>
> Generated classes (from the modeler) isn't creating the addTo... and
> removeFrom... methods.  Actually, neither is running it from the ant
> cgen task.
>
> My other project has similar relationships (although I can't remember
> if I made the join table with dependent primary keys) and the methods
> are generating without problem.
>
> -Mike
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <data-map project-version="1.1">
>     <property name="defaultLockType" value="optimistic"/>
>     <property name="defaultPackage"  
> value="com.gvea.announcement.entity"/>
>     <property name="defaultSuperclass"  
> value="com.gvea.cayenne.BaseDataObject"/>
>     <db-entity name="ANNOUNCEMENT">
>         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> isPrimaryKey="true" isMandatory="true"/>
> [...]
>     </db-entity>
>     <db-entity name="ANNOUNCEMENT__CONTENT">
>         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> isPrimaryKey="true" isMandatory="true"/>
>         <db-attribute name="CONTENT_ID" type="NUMERIC"  
> isPrimaryKey="true"
> isMandatory="true"/>
>     </db-entity>
>     <db-entity name="CONTENT">
>         <db-attribute name="CONTENT_ID" type="NUMERIC"  
> isPrimaryKey="true"
> isMandatory="true"/>
> [...]
>     </db-entity>
>
>     <obj-entity name="Announcement"
> className="com.gvea.announcement.entity.Announcement"
> lock-type="optimistic" dbEntityName="ANNOUNCEMENT"
> superClassName="com.gvea.cayenne.BaseDataObject">
> [...]
>     </obj-entity>
>     <obj-entity name="Content"
> className="com.gvea.announcement.entity.Content"
> lock-type="optimistic" dbEntityName="CONTENT"
> superClassName="com.gvea.cayenne.BaseDataObject">
> [...]
>     </obj-entity>
>
>     <db-relationship name="contentJoinList" source="ANNOUNCEMENT"
> target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
>         <db-attribute-pair source="ANNOUNCEMENT_ID"  
> target="ANNOUNCEMENT_ID"/>
>     </db-relationship>
>
>     <db-relationship name="announcementList"
> source="ANNOUNCEMENT__CONTENT" target="ANNOUNCEMENT" toMany="true">
>         <db-attribute-pair source="ANNOUNCEMENT_ID"  
> target="ANNOUNCEMENT_ID"/>
>     </db-relationship>
>
>     <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> target="CONTENT" toMany="true">
>         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
>     </db-relationship>
>
>     <db-relationship name="announcementList"
> source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
>         <db-attribute-pair source="ANNOUNCEMENT_ID"  
> target="ANNOUNCEMENT_ID"/>
>     </db-relationship>
>
>
>     <db-relationship name="announcementJoinList" source="CONTENT"
> target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
>         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
>     </db-relationship>
>
>     <obj-relationship name="contentList" source="Announcement"
> target="Content" deleteRule="Cascade"
> db-relationship-path="contentJoinList.contentList"/>
>
> </data-map>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Andrus Adamchik
Sorry, the second suspect relationship is this:

>  <db-relationship name="announcementList"
> source="ANNOUNCEMENT__CONTENT" target="ANNOUNCEMENT" toMany="true">
>         <db-attribute-pair source="ANNOUNCEMENT_ID"  
> target="ANNOUNCEMENT_ID"/>
>     </db-relationship>



On Aug 31, 2005, at 12:31 PM, Andrus Adamchik wrote:

> Mike, the reason for that is that relationship is treated as read-
> only. Maybe because these two relationships FROM a join table are  
> marked as to-many while they should be to-one?
>
> Andrus
>
>
>
>> <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
>> target="CONTENT" toMany="true">
>>         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
>>     </db-relationship>
>>
>>     <db-relationship name="announcementList"
>> source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
>>         <db-attribute-pair source="ANNOUNCEMENT_ID"  
>> target="ANNOUNCEMENT_ID"/>
>>     </db-relationship>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Mike Kienenberger
In reply to this post by Andrus Adamchik
Doh!
Yeah.
I knew it was something simple like that, which is why I asked :)

Yes, I mistakenly marked them as to-many.


On 8/31/05, Andrus Adamchik <[hidden email]> wrote:

> Mike, the reason for that is that relationship is treated as read-
> only. Maybe because these two relationships FROM a join table are
> marked as to-many while they should be to-one?
>
> Andrus
>
>
> > <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> > target="CONTENT" toMany="true">
> >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> >     </db-relationship>
> >
> >     <db-relationship name="announcementList"
> > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
> >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > target="ANNOUNCEMENT_ID"/>
> >     </db-relationship>
>
>
>
>
>
> On Aug 31, 2005, at 12:27 PM, Mike Kienenberger wrote:
>
> > I'm trying to set up some flattened relationships in a new project and
> > data map using the modeler, and I'm having some problems.
> >
> > Generated classes (from the modeler) isn't creating the addTo... and
> > removeFrom... methods.  Actually, neither is running it from the ant
> > cgen task.
> >
> > My other project has similar relationships (although I can't remember
> > if I made the join table with dependent primary keys) and the methods
> > are generating without problem.
> >
> > -Mike
> >
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <data-map project-version="1.1">
> >     <property name="defaultLockType" value="optimistic"/>
> >     <property name="defaultPackage"
> > value="com.gvea.announcement.entity"/>
> >     <property name="defaultSuperclass"
> > value="com.gvea.cayenne.BaseDataObject"/>
> >     <db-entity name="ANNOUNCEMENT">
> >         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> > isPrimaryKey="true" isMandatory="true"/>
> > [...]
> >     </db-entity>
> >     <db-entity name="ANNOUNCEMENT__CONTENT">
> >         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> > isPrimaryKey="true" isMandatory="true"/>
> >         <db-attribute name="CONTENT_ID" type="NUMERIC"
> > isPrimaryKey="true"
> > isMandatory="true"/>
> >     </db-entity>
> >     <db-entity name="CONTENT">
> >         <db-attribute name="CONTENT_ID" type="NUMERIC"
> > isPrimaryKey="true"
> > isMandatory="true"/>
> > [...]
> >     </db-entity>
> >
> >     <obj-entity name="Announcement"
> > className="com.gvea.announcement.entity.Announcement"
> > lock-type="optimistic" dbEntityName="ANNOUNCEMENT"
> > superClassName="com.gvea.cayenne.BaseDataObject">
> > [...]
> >     </obj-entity>
> >     <obj-entity name="Content"
> > className="com.gvea.announcement.entity.Content"
> > lock-type="optimistic" dbEntityName="CONTENT"
> > superClassName="com.gvea.cayenne.BaseDataObject">
> > [...]
> >     </obj-entity>
> >
> >     <db-relationship name="contentJoinList" source="ANNOUNCEMENT"
> > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
> >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > target="ANNOUNCEMENT_ID"/>
> >     </db-relationship>
> >
> >     <db-relationship name="announcementList"
> > source="ANNOUNCEMENT__CONTENT" target="ANNOUNCEMENT" toMany="true">
> >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > target="ANNOUNCEMENT_ID"/>
> >     </db-relationship>
> >
> >     <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> > target="CONTENT" toMany="true">
> >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> >     </db-relationship>
> >
> >     <db-relationship name="announcementList"
> > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
> >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > target="ANNOUNCEMENT_ID"/>
> >     </db-relationship>
> >
> >
> >     <db-relationship name="announcementJoinList" source="CONTENT"
> > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
> >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> >     </db-relationship>
> >
> >     <obj-relationship name="contentList" source="Announcement"
> > target="Content" deleteRule="Cascade"
> > db-relationship-path="contentJoinList.contentList"/>
> >
> > </data-map>
> >
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Mike Kienenberger
Ok.  Well, that's odd.  It now generates correct code from ant cgen,
but not from the modeler.   I wonder if that's an indication of
another problem.   I rarely use the modeler to generate my code.


On 8/31/05, Mike Kienenberger <[hidden email]> wrote:

> Doh!
> Yeah.
> I knew it was something simple like that, which is why I asked :)
>
> Yes, I mistakenly marked them as to-many.
>
>
> On 8/31/05, Andrus Adamchik <[hidden email]> wrote:
> > Mike, the reason for that is that relationship is treated as read-
> > only. Maybe because these two relationships FROM a join table are
> > marked as to-many while they should be to-one?
> >
> > Andrus
> >
> >
> > > <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> > > target="CONTENT" toMany="true">
> > >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> > >     </db-relationship>
> > >
> > >     <db-relationship name="announcementList"
> > > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
> > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > target="ANNOUNCEMENT_ID"/>
> > >     </db-relationship>
> >
> >
> >
> >
> >
> > On Aug 31, 2005, at 12:27 PM, Mike Kienenberger wrote:
> >
> > > I'm trying to set up some flattened relationships in a new project and
> > > data map using the modeler, and I'm having some problems.
> > >
> > > Generated classes (from the modeler) isn't creating the addTo... and
> > > removeFrom... methods.  Actually, neither is running it from the ant
> > > cgen task.
> > >
> > > My other project has similar relationships (although I can't remember
> > > if I made the join table with dependent primary keys) and the methods
> > > are generating without problem.
> > >
> > > -Mike
> > >
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <data-map project-version="1.1">
> > >     <property name="defaultLockType" value="optimistic"/>
> > >     <property name="defaultPackage"
> > > value="com.gvea.announcement.entity"/>
> > >     <property name="defaultSuperclass"
> > > value="com.gvea.cayenne.BaseDataObject"/>
> > >     <db-entity name="ANNOUNCEMENT">
> > >         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> > > isPrimaryKey="true" isMandatory="true"/>
> > > [...]
> > >     </db-entity>
> > >     <db-entity name="ANNOUNCEMENT__CONTENT">
> > >         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> > > isPrimaryKey="true" isMandatory="true"/>
> > >         <db-attribute name="CONTENT_ID" type="NUMERIC"
> > > isPrimaryKey="true"
> > > isMandatory="true"/>
> > >     </db-entity>
> > >     <db-entity name="CONTENT">
> > >         <db-attribute name="CONTENT_ID" type="NUMERIC"
> > > isPrimaryKey="true"
> > > isMandatory="true"/>
> > > [...]
> > >     </db-entity>
> > >
> > >     <obj-entity name="Announcement"
> > > className="com.gvea.announcement.entity.Announcement"
> > > lock-type="optimistic" dbEntityName="ANNOUNCEMENT"
> > > superClassName="com.gvea.cayenne.BaseDataObject">
> > > [...]
> > >     </obj-entity>
> > >     <obj-entity name="Content"
> > > className="com.gvea.announcement.entity.Content"
> > > lock-type="optimistic" dbEntityName="CONTENT"
> > > superClassName="com.gvea.cayenne.BaseDataObject">
> > > [...]
> > >     </obj-entity>
> > >
> > >     <db-relationship name="contentJoinList" source="ANNOUNCEMENT"
> > > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
> > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > target="ANNOUNCEMENT_ID"/>
> > >     </db-relationship>
> > >
> > >     <db-relationship name="announcementList"
> > > source="ANNOUNCEMENT__CONTENT" target="ANNOUNCEMENT" toMany="true">
> > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > target="ANNOUNCEMENT_ID"/>
> > >     </db-relationship>
> > >
> > >     <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> > > target="CONTENT" toMany="true">
> > >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> > >     </db-relationship>
> > >
> > >     <db-relationship name="announcementList"
> > > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
> > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > target="ANNOUNCEMENT_ID"/>
> > >     </db-relationship>
> > >
> > >
> > >     <db-relationship name="announcementJoinList" source="CONTENT"
> > > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
> > >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> > >     </db-relationship>
> > >
> > >     <obj-relationship name="contentList" source="Announcement"
> > > target="Content" deleteRule="Cascade"
> > > db-relationship-path="contentJoinList.contentList"/>
> > >
> > > </data-map>
> > >
> > >
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Mike Kienenberger
Weird.   I closed the project and reopened it, and now the modeler is
generating classes correctly.

On 8/31/05, Mike Kienenberger <[hidden email]> wrote:

> Ok.  Well, that's odd.  It now generates correct code from ant cgen,
> but not from the modeler.   I wonder if that's an indication of
> another problem.   I rarely use the modeler to generate my code.
>
>
> On 8/31/05, Mike Kienenberger <[hidden email]> wrote:
> > Doh!
> > Yeah.
> > I knew it was something simple like that, which is why I asked :)
> >
> > Yes, I mistakenly marked them as to-many.
> >
> >
> > On 8/31/05, Andrus Adamchik <[hidden email]> wrote:
> > > Mike, the reason for that is that relationship is treated as read-
> > > only. Maybe because these two relationships FROM a join table are
> > > marked as to-many while they should be to-one?
> > >
> > > Andrus
> > >
> > >
> > > > <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> > > > target="CONTENT" toMany="true">
> > > >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> > > >     </db-relationship>
> > > >
> > > >     <db-relationship name="announcementList"
> > > > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
> > > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > > target="ANNOUNCEMENT_ID"/>
> > > >     </db-relationship>
> > >
> > >
> > >
> > >
> > >
> > > On Aug 31, 2005, at 12:27 PM, Mike Kienenberger wrote:
> > >
> > > > I'm trying to set up some flattened relationships in a new project and
> > > > data map using the modeler, and I'm having some problems.
> > > >
> > > > Generated classes (from the modeler) isn't creating the addTo... and
> > > > removeFrom... methods.  Actually, neither is running it from the ant
> > > > cgen task.
> > > >
> > > > My other project has similar relationships (although I can't remember
> > > > if I made the join table with dependent primary keys) and the methods
> > > > are generating without problem.
> > > >
> > > > -Mike
> > > >
> > > >
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <data-map project-version="1.1">
> > > >     <property name="defaultLockType" value="optimistic"/>
> > > >     <property name="defaultPackage"
> > > > value="com.gvea.announcement.entity"/>
> > > >     <property name="defaultSuperclass"
> > > > value="com.gvea.cayenne.BaseDataObject"/>
> > > >     <db-entity name="ANNOUNCEMENT">
> > > >         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> > > > isPrimaryKey="true" isMandatory="true"/>
> > > > [...]
> > > >     </db-entity>
> > > >     <db-entity name="ANNOUNCEMENT__CONTENT">
> > > >         <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
> > > > isPrimaryKey="true" isMandatory="true"/>
> > > >         <db-attribute name="CONTENT_ID" type="NUMERIC"
> > > > isPrimaryKey="true"
> > > > isMandatory="true"/>
> > > >     </db-entity>
> > > >     <db-entity name="CONTENT">
> > > >         <db-attribute name="CONTENT_ID" type="NUMERIC"
> > > > isPrimaryKey="true"
> > > > isMandatory="true"/>
> > > > [...]
> > > >     </db-entity>
> > > >
> > > >     <obj-entity name="Announcement"
> > > > className="com.gvea.announcement.entity.Announcement"
> > > > lock-type="optimistic" dbEntityName="ANNOUNCEMENT"
> > > > superClassName="com.gvea.cayenne.BaseDataObject">
> > > > [...]
> > > >     </obj-entity>
> > > >     <obj-entity name="Content"
> > > > className="com.gvea.announcement.entity.Content"
> > > > lock-type="optimistic" dbEntityName="CONTENT"
> > > > superClassName="com.gvea.cayenne.BaseDataObject">
> > > > [...]
> > > >     </obj-entity>
> > > >
> > > >     <db-relationship name="contentJoinList" source="ANNOUNCEMENT"
> > > > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
> > > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > > target="ANNOUNCEMENT_ID"/>
> > > >     </db-relationship>
> > > >
> > > >     <db-relationship name="announcementList"
> > > > source="ANNOUNCEMENT__CONTENT" target="ANNOUNCEMENT" toMany="true">
> > > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > > target="ANNOUNCEMENT_ID"/>
> > > >     </db-relationship>
> > > >
> > > >     <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
> > > > target="CONTENT" toMany="true">
> > > >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> > > >     </db-relationship>
> > > >
> > > >     <db-relationship name="announcementList"
> > > > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
> > > >         <db-attribute-pair source="ANNOUNCEMENT_ID"
> > > > target="ANNOUNCEMENT_ID"/>
> > > >     </db-relationship>
> > > >
> > > >
> > > >     <db-relationship name="announcementJoinList" source="CONTENT"
> > > > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
> > > >         <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
> > > >     </db-relationship>
> > > >
> > > >     <obj-relationship name="contentList" source="Announcement"
> > > > target="Content" deleteRule="Cascade"
> > > > db-relationship-path="contentJoinList.contentList"/>
> > > >
> > > > </data-map>
> > > >
> > > >
> > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Andrus Adamchik
IIRC there was bug report about it. Can't find it now. Maybe it was  
fixed already. Are you using the latest Modeler (at least M5) or is  
it 1.1?

Andrus

On Aug 31, 2005, at 12:44 PM, Mike Kienenberger wrote:

> Weird.   I closed the project and reopened it, and now the modeler is
> generating classes correctly.

Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Mike Kienenberger
I built it on July 11 -- I don't remember if that was before M5 or not.

-Mike

On 8/31/05, Andrus Adamchik <[hidden email]> wrote:

> IIRC there was bug report about it. Can't find it now. Maybe it was
> fixed already. Are you using the latest Modeler (at least M5) or is
> it 1.1?
>
> Andrus
>
> On Aug 31, 2005, at 12:44 PM, Mike Kienenberger wrote:
>
> > Weird.   I closed the project and reopened it, and now the modeler is
> > generating classes correctly.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Mike Kienenberger
I guess not since M5 came out on July 22nd.

On 8/31/05, Mike Kienenberger <[hidden email]> wrote:

> I built it on July 11 -- I don't remember if that was before M5 or not.
>
> -Mike
>
> On 8/31/05, Andrus Adamchik <[hidden email]> wrote:
> > IIRC there was bug report about it. Can't find it now. Maybe it was
> > fixed already. Are you using the latest Modeler (at least M5) or is
> > it 1.1?
> >
> > Andrus
> >
> > On Aug 31, 2005, at 12:44 PM, Mike Kienenberger wrote:
> >
> > > Weird.   I closed the project and reopened it, and now the modeler is
> > > generating classes correctly.
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Andrus Adamchik
Fix is not mentioned in the M5 release notes anyways. It probably  
makes sense to open a new bug report and test it with the latest CVS  
code.

Andrus

On Aug 31, 2005, at 12:54 PM, Mike Kienenberger wrote:

> I guess not since M5 came out on July 22nd.
>
> On 8/31/05, Mike Kienenberger <[hidden email]> wrote:
>
>> I built it on July 11 -- I don't remember if that was before M5 or  
>> not.
>>
>> -Mike
>>
>> On 8/31/05, Andrus Adamchik <[hidden email]> wrote:
>>
>>> IIRC there was bug report about it. Can't find it now. Maybe it was
>>> fixed already. Are you using the latest Modeler (at least M5) or is
>>> it 1.1?
>>>
>>> Andrus
>>>
>>> On Aug 31, 2005, at 12:44 PM, Mike Kienenberger wrote:
>>>
>>>
>>>> Weird.   I closed the project and reopened it, and now the  
>>>> modeler is
>>>> generating classes correctly.
>>>>
>>>
>>>
>>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Unable to generate addTo... and removeFrom... methods

Mike Kienenberger
Ok.  I'll see what I can do later today.

On 8/31/05, Andrus Adamchik <[hidden email]> wrote:

> Fix is not mentioned in the M5 release notes anyways. It probably
> makes sense to open a new bug report and test it with the latest CVS
> code.
>
> Andrus
>
> On Aug 31, 2005, at 12:54 PM, Mike Kienenberger wrote:
>
> > I guess not since M5 came out on July 22nd.
> >
> > On 8/31/05, Mike Kienenberger <[hidden email]> wrote:
> >
> >> I built it on July 11 -- I don't remember if that was before M5 or
> >> not.
> >>
> >> -Mike
> >>
> >> On 8/31/05, Andrus Adamchik <[hidden email]> wrote:
> >>
> >>> IIRC there was bug report about it. Can't find it now. Maybe it was
> >>> fixed already. Are you using the latest Modeler (at least M5) or is
> >>> it 1.1?
> >>>
> >>> Andrus
> >>>
> >>> On Aug 31, 2005, at 12:44 PM, Mike Kienenberger wrote:
> >>>
> >>>
> >>>> Weird.   I closed the project and reopened it, and now the
> >>>> modeler is
> >>>> generating classes correctly.
> >>>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
>
>
Reply | Threaded
Open this post in threaded view
|

How to dynamically get Qualifier info from SelectQuery object

haranbanjo
In reply to this post by Mike Kienenberger
Hi,
i want to extract at runtime the quelifier data from a SelectQuery object.

I have a query defined in a datamap xml file:
---------------------------------------------------
<query name="qryStat" factory="org.objectstyle.cayenne.map.SelectQueryBuilder" root="obj-entity" root-name="stat">
        <qualifier>
                <![CDATA[(USER_ID = $userId)]]>
        </qualifier>
</query>
---------------------------------------------------

I have obtained a SelectQuery:

---------------------------------------------------
SelectQuery qry = (SelectQuery) resolver.getQuery("qryStat");
---------------------------------------------------

How i can retrive the field name used in "where" expression? (USER_ID)
Is possible to get it form a property defined in SelectQuery ?

Thank's
Davide
Reply | Threaded
Open this post in threaded view
|

Re: How to dynamically get Qualifier info from SelectQuery object

Mike Kienenberger
Expression e  = qry.getQualifier() will give you the qualifier
expression that is built from <![CDATA[(USER_ID = $userId)]]>.



On 9/1/05, Pirola Davide <[hidden email]> wrote:

> Hi,
> i want to extract at runtime the quelifier data from a SelectQuery object.
>
> I have a query defined in a datamap xml file:
> ---------------------------------------------------
> <query name="qryStat" factory="org.objectstyle.cayenne.map.SelectQueryBuilder" root="obj-entity" root-name="stat">
>         <qualifier>
>                 <![CDATA[(USER_ID = $userId)]]>
>         </qualifier>
> </query>
> ---------------------------------------------------
>
> I have obtained a SelectQuery:
>
> ---------------------------------------------------
> SelectQuery qry = (SelectQuery) resolver.getQuery("qryStat");
> ---------------------------------------------------
>
> How i can retrive the field name used in "where" expression? (USER_ID)
> Is possible to get it form a property defined in SelectQuery ?
>
> Thank's
> Davide
>
Reply | Threaded
Open this post in threaded view
|

RE: How to dynamically get Qualifier info from SelectQuery object

haranbanjo
In reply to this post by haranbanjo
Hi,
i have noticed that if i want to access to a single qualifier:

<![CDATA[(USER_ID = $userId)]]>

the operand count is 2... the first is "USER_ID" and the second is "$userId".

If i use a multiple qualifier:

<![CDATA[((UserId = $userId) and (Name = $name))]]>

the operand count is always 2... but now the first is "UserId  = $userId" and the second is "Name = $name".

Why this different behavior?
There isn't a standard method to retrive a field name?

thank's
Davide





-----Original Message-----
From: Mike Kienenberger [mailto:[hidden email]]
Sent: giovedì 1 settembre 2005 16.42
To: [hidden email]
Subject: Re: How to dynamically get Qualifier info from SelectQuery
object


Expression e  = qry.getQualifier() will give you the qualifier
expression that is built from <![CDATA[(USER_ID = $userId)]]>.



On 9/1/05, Pirola Davide <[hidden email]> wrote:

> Hi,
> i want to extract at runtime the quelifier data from a SelectQuery object.
>
> I have a query defined in a datamap xml file:
> ---------------------------------------------------
> <query name="qryStat" factory="org.objectstyle.cayenne.map.SelectQueryBuilder" root="obj-entity" root-name="stat">
>         <qualifier>
>                 <![CDATA[(USER_ID = $userId)]]>
>         </qualifier>
> </query>
> ---------------------------------------------------
>
> I have obtained a SelectQuery:
>
> ---------------------------------------------------
> SelectQuery qry = (SelectQuery) resolver.getQuery("qryStat");
> ---------------------------------------------------
>
> How i can retrive the field name used in "where" expression? (USER_ID)
> Is possible to get it form a property defined in SelectQuery ?
>
> Thank's
> Davide
>
Reply | Threaded
Open this post in threaded view
|

Re: How to dynamically get Qualifier info from SelectQuery object

Mike Kienenberger
That's because Expression isn't a string and a list of arguments.

It's a hierarchical struture.  You're actually working with three Expressions.

AndExpression contains the userid Expression and the name Expression


On 9/1/05, Pirola Davide <[hidden email]> wrote:

> Hi,
> i have noticed that if i want to access to a single qualifier:
>
> <![CDATA[(USER_ID = $userId)]]>
>
> the operand count is 2... the first is "USER_ID" and the second is "$userId".
>
> If i use a multiple qualifier:
>
> <![CDATA[((UserId = $userId) and (Name = $name))]]>
>
> the operand count is always 2... but now the first is "UserId  = $userId" and the second is "Name = $name".
>
> Why this different behavior?
> There isn't a standard method to retrive a field name?
>
> thank's
> Davide
>
>
>
>
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:[hidden email]]
> Sent: giovedì 1 settembre 2005 16.42
> To: [hidden email]
> Subject: Re: How to dynamically get Qualifier info from SelectQuery
> object
>
>
> Expression e  = qry.getQualifier() will give you the qualifier
> expression that is built from <![CDATA[(USER_ID = $userId)]]>.
>
>
>
> On 9/1/05, Pirola Davide <[hidden email]> wrote:
> > Hi,
> > i want to extract at runtime the quelifier data from a SelectQuery object.
> >
> > I have a query defined in a datamap xml file:
> > ---------------------------------------------------
> > <query name="qryStat" factory="org.objectstyle.cayenne.map.SelectQueryBuilder" root="obj-entity" root-name="stat">
> >         <qualifier>
> >                 <![CDATA[(USER_ID = $userId)]]>
> >         </qualifier>
> > </query>
> > ---------------------------------------------------
> >
> > I have obtained a SelectQuery:
> >
> > ---------------------------------------------------
> > SelectQuery qry = (SelectQuery) resolver.getQuery("qryStat");
> > ---------------------------------------------------
> >
> > How i can retrive the field name used in "where" expression? (USER_ID)
> > Is possible to get it form a property defined in SelectQuery ?
> >
> > Thank's
> > Davide
> >
>