Should we implement this paradigm in the codegenerator ? (of course as an
option)
Maybe something like this:
<property name="parent" class="eg.Parent">
<metaattribute name="CodeGen.genCompositeGetSet" value="true"/>
</property>
Where the codegen would generate something like the code below if
"CodeGen.genCompositeGetSet" is set for the property and/or relationship.
/max
----- Original Message -----
From: "Christian Bauer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 10:31 AM
Subject: Re: Bi-directional relationships (was Re: [Hibernate] Are toplevel
collections / subcollections a Bad Thing?)
> On 19 Dec (09:20), Jim Downing wrote:
>
> > Thanks - I'd used the advance in Tom's manual to do the mapping, but I
> > was trying to maintain the relationship in my persistent objects
> > (rather than making the client do it, as in the FAQ), which was
> > probably the cause of my problems.
>
> Thats exactly what I'm doing:
>
> class Child {
>
> public setParent(Parent newParent) {
>
> // Remove myself from old Parent
> if (this.parent != null) {
> this.parent.getChildren().remove(this);
> }
>
> // Add to new Parent
> newParent.getChildren().add(this);
>
> // Set new Parent
> this.parent = newParent;
> }
> }
>
> This is similar to the Composite Pattern (or better, a part of it):
>
> http://www.idg.net/english/crd_composite_948016.html
>
> --
> Christian Bauer
> [EMAIL PROTECTED]
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: Geek Gift Procrastinating?
> Get the perfect geek gift now! Before the Holidays pass you by.
> T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>
-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now! Before the Holidays pass you by.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel