Hi Dan
The reactor alias attribute solved my problem!
Thanks a lot for your help!
Thomas
If someone else has the same problem, here's the solution:
[Reactor.xml]
<object name="MenuPunkt">
<!-- SET YOUR FK ALIAS HERE -->
<field name="fkMenuGruppeID" alias="MenuGruppeID" />
<hasOne name="MenuGruppe">
<relate from="MenuGruppeID" to="MenuGruppeID" />
</hasOne>
</object>
<object name="MenuGruppe">
<hasMany name="MenuPunkt">
<relate from="MenuGruppeID" to="MenuGruppeID" />
</hasMany>
</object>
On Oct 25, 2:25 pm, Dan Wilson <[email protected]> wrote:
> Thomas,
>
> The Alias attribute is specific to the Reactor framework. You should review
> this piece of the Reactor documentation for the Alias attribute.
>
> http://livedocs.reactorframework.org/field_tag.htm
>
> DW
>
>
>
> On Mon, Oct 25, 2010 at 4:00 AM, Thomas <[email protected]> wrote:
> > Hi Dan
>
> > Thanks for your answer, I think you understood the issue. I tried
> > different things, but the Problem still exists.
>
> > The form field in the generated edit form is named TableID instead of
> > fkTableID. If I change that with Firebug before sending the form, it
> > works fine.
> > Editing the generated HTML is not that easy, because it's generated
> > with the fancy scaffoding custom tags wich uses the cfuniform library
> > to generate the html. So I would have to override some beans and their
> > behaviour... that's too much for my current modelglue level ;-)
>
> > Your suggestion to use an alias sounds much better to me. How and
> > where can I set aliases for table fields?
>
> > Thanks for your help! thomas
>
> > On Oct 22, 6:33 pm, Dan Wilson <[email protected]> wrote:
> > > Hi Thomas,
>
> > > I've been thinking about this for a little bit. In short, I'm not sure of
> > > the exact problem.
>
> > > If you have a form and the form field is named fkTableID, and you pass
> > > TableID, then I would expect there to be an issue. You may be able to use
> > an
> > > alias to change this, so that the values match.
>
> > > It's been a while since I used the Scaffolding Functionality of Model
> > Glue.
> > > While it's pretty good, it isn't perfect and there are things it just
> > > doesn't do automatically.
>
> > > You could, however, edit the generated HTML and rename the field if you
> > > wanted to. That way you get all the benefit of the code generation and
> > also
> > > you get the flexibility of making it work the way you want.
>
> > > If I have misunderstood your current issue, please write back. How this
> > > works is still a little fuzzy since I haven't used scaffolding in a
> > little
> > > bit.
>
> > > DW
>
> > > On Fri, Oct 22, 2010 at 8:35 AM, Thomas <[email protected]> wrote:
> > > > Hi everyone
>
> > > > I am having some problems with scaffolding and foreign key prefixes.
> > > > I'm using MG 3.2.700.341 with reactor as ORM.
>
> > > > If the primary key of a table is TableID then I use fkTableID for the
> > > > foreign key in an other table.
>
> > > > The scaffolding forms and pages are generated and working, the foreign
> > > > key is a select box in the edit form.
> > > > So far so good. If I want to to add or edit an entry then I get the
> > > > following error:
>
> > > > [Macromedia][SQLServer JDBC Driver][SQLServer]The INSERT statement
> > > > conflicted with the FOREIGN KEY constraint "FK_MenuPunkt_MenuGruppe".
> > > > The conflict occurred in database "ProdukteKatalog", table
> > > > "dbo.MenuGruppe", column 'MenuGruppeID'.
>
> > > > If I remove the relationship between the 2 tables on SQL Server, I can
> > > > see that the fk is always 0. If the foreign key and the primary key
> > > > have the same name, then inserting and editing works fine.
>
> > > > Is it possible to have different names for pk and fk or do they have
> > > > to be the same?
>
> > > > Thanks in advance for any hints
>
> > > > Thomas
>
> > > > Reactor.xml config:
> > > > <object name="MenuPunkt">
> > > > <hasOne name="MenuGruppe">
> > > > <relate from="fkMenuGruppeID" to="MenuGruppeID" />
> > > > </hasOne>
> > > > </object>
> > > > <object name="MenuGruppe">
> > > > <hasMany name="MenuPunkt">
> > > > <relate from="MenuGruppeID" to="fkMenuGruppeID" />
> > > > </hasMany>
> > > > </object>
>
> > > > ModelGlue.xml config:
> > > > <scaffold object="MenuPunkt">
> > > > <results>
> > > > <result do="template.main" />
> > > > </results>
> > > > </scaffold>
> > > > <scaffold object="MenuGruppe">
> > > > <results>
> > > > <result do="template.main" />
> > > > </results>
> > > > </scaffold>
>
> > > > --
> > > > Model-Glue Sites:
> > > > Home Page:http://www.model-glue.com
> > > > Documentation:http://docs.model-glue.com
> > > > Bug Tracker:http://bugs.model-glue.com
> > > > Blog:http://www.model-glue.com/blog
>
> > > > You received this message because you are subscribed to the Google
> > > > Groups "model-glue" group.
> > > > To post to this group, send email to [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<model-glue%[email protected]>
> > <model-glue%[email protected]<model-glue%[email protected]>
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/model-glue?hl=en
>
> > > --
> > > William Osler - "We are here to add what we can to life, not to get what
> > we
> > > can from life."
>
> > --
> > Model-Glue Sites:
> > Home Page:http://www.model-glue.com
> > Documentation:http://docs.model-glue.com
> > Bug Tracker:http://bugs.model-glue.com
> > Blog:http://www.model-glue.com/blog
>
> > You received this message because you are subscribed to the Google
> > Groups "model-glue" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<model-glue%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/model-glue?hl=en
>
> --
> William Osler - "We are here to add what we can to life, not to get what we
> can from life."
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en