This is one of examples ("containment" with "opposite" association), but generated code depends on model too, "reference" will be generated in different way and you need to know model to persist it in the right way (generated code has meta information). It is not a good idea to asume generated code implementation, it must be better to see EMF reflection related stuff (EObject methods with "e" prefix) and standard EMF way to integrate custom persistence is "Resource" API
--- Max Rydahl Andersen <[EMAIL PROTECTED]> wrote: > > And this code is auto-generated into your "domain" > classes ? > Damn - EMF is way more intrusive than I thought. > > But anyhow - "elements" is some field, right ? Then > hibernate can set it! > > Regarding getting the "owning element" into the > collection. > Can only tell that PersistentCollection.setOwner() > will be called > immediatly after instantiation - > is that not enough for you ? > > I would expect you would not need to actually > instantiate the underlying > collection before you are actualled accessed. > > /max > > > > > > It looks something like this: > > > > public EList getElements() { > > if (elements == null) { > > elements = new > > > EObjectContainmentWithInverseEList(MyElement.class, > > this, MyGenPackage.ELEMENTS_FEATURE_ID, > > MyGenPackage.PARENT_FEATURE_ID); > > } > > return elements; > > } > > > > This stuff depends on EMF interfaces and > > implementation classes, probably code generation > > "pattern" depends on EMF versions too. > > Common EMF use case are generated "metamodel" (it > is > > used by modeling tools like UML diagram editors) > > custom code is generated from "metamodel" using > custom > > templates and "patterns" without EMF dependecy . > > > > --- Max Rydahl Andersen <[EMAIL PROTECTED]> > > wrote: > > > >> > 1. Note that EMF owns the instantiation of the > >> collection. > >> > > >> > An application (or Hibernate) cannot call > >> setPlayers since it does not > >> > exist. > >> > >> so how does EMF set it ? > >> > >> /max > >> > >> > >> > > > ------------------------------------------------------- > >> This SF.Net email is sponsored by: NEC IT Guy > Games. > >> How far can you shotput > >> a projector? How fast can you ride your desk > chair > >> down the office luge track? > >> If you want to score the big prize, get to know > the > >> little guy. > >> Play to win an NEC 61" plasma display: > >> http://www.necitguy.com/?r=20 > >> _______________________________________________ > >> hibernate-devel mailing list > >> hibernate-devel@lists.sourceforge.net > >> > > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > >> > > > > > > > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! Mail - Find what you need with new enhanced > search. > > http://info.mail.yahoo.com/mail_250 > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > How far can you shotput > a projector? How fast can you ride your desk chair > down the office luge track? > If you want to score the big prize, get to know the > little guy. > Play to win an NEC 61" plasma display: > http://www.necitguy.com/?r=20 > _______________________________________________ > hibernate-devel mailing list > hibernate-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel