Your outter bean should already have a reference to it when the getter
is called.  The EventBean stuff doesn't re-set a bean using a setter
after getting it from the outter bean because CFCs are passed by
reference and there is no need to do that. When you create the new inner
bean, you have to stash a reference to it in the outter bean before
returning it from the getter.


Looks like your getter for it does not abide by that contract so a new
ExtraData is created but not assigned to any variable (i.e. the CFC this
scope) and therefore is transient / orphaned.  It should look something
like this:

public function getExtraData(){
  if(isNull(this.extraData)){
   this.extraData = new extraData();
  }
   return this.extraData;
}

The CFML and Java standard with beans is that you don't have to re-set
data that is passed by reference to setter when you've gotten it from
the getter.  It's really up to the target CFC you are calling the getter
in if that CFC needs to hold a reference to that object being created.

HTH,
.Peter

Sumit Verma said the following on 08/02/2010 10:58 PM:
> That's what I had yesterday (and now), and the bean is not getting
> populated. No error. In EventBeanCommand.cfc if I dump inner bean on
> line 184 I get the inner bean populated with new data, but my parent
> bean still has the old inner bean when I get to Listner...
>
>
> Sumit Verma
> Partner / Vice President | ten24, LLC
> office: 877.886.5806 x 103 | mobile: 617.290.8214
> www.ten24web.com <http://www.ten24web.com> |
> www.linkedin.com/in/sverma <http://www.linkedin.com/in/sverma> |
> twitter: blogonria
>
>
> On Mon, Aug 2, 2010 at 11:24 PM, Kurt Wiersma <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Yes I think you should try having that getter create a new extraData
>     object so it is created before the inner-bean stuff starts calling
>     setters on it.
>
>     --Kurt
>
>     On Mon, Aug 2, 2010 at 10:05 PM, Sumit Verma <[email protected]
>     <mailto:[email protected]>> wrote:
>     > Ok, so, here is what I'm trying to do.
>     > I have a one-to-one relationship.
>     > data.cfc {
>     >   property id;
>     >   property extraData one-to-one;
>     > }
>     > extraData.cfc {
>     >   property id generator foreign;
>     >   property data one-to-one constrained;
>     >   property foo;
>     > }
>     > Now, extraData could be null. So, when I get data bean the extraData
>     > property could return null. So, first issue is to figure out the
>     how to
>     > return the empty extra data bean. Should I do:
>     > public function getExtraData(){
>     >   if(isNull(this.extraData)){
>     >     return new extraData();
>     >   } else {
>     >     return this.extraData;
>     >   }
>     > }
>     >
>     > Not sure if that's the right way? Doesn't feel quite right...
>     > Then the next is populating the extraData property through
>     inner-bean.
>     > <event-bean name="data" type="data" reinit="false">
>     >   <inner-bean name="extraData" prefix="extraData" />
>     > </event-bean>
>     >
>     > Hope this explains the situation...
>     >
>     > Sumit Verma
>     > Partner / Vice President | ten24, LLC
>     > office: 877.886.5806 x 103 | mobile: 617.290.8214
>     > www.ten24web.com <http://www.ten24web.com> |
>     www.linkedin.com/in/sverma <http://www.linkedin.com/in/sverma> |
>     twitter: blogonria
>     >
>     >
>     > On Mon, Aug 2, 2010 at 1:00 PM, Kurt Wiersma <[email protected]
>     <mailto:[email protected]>> wrote:
>     >>
>     >> Can you describe the situation and how your beans are setup a
>     bit more?
>     >>
>     >> --Kurt
>     >>
>     >> On Mon, Aug 2, 2010 at 1:37 AM, Sumit Verma
>     <[email protected] <mailto:[email protected]>> wrote:
>     >> > Hi Guys,
>     >> >
>     >> > I'm using Mach-ii 1.8.0.8 and inner bean is not working for me. I
>     >> > tried to debug the code and in the EventBeanCommand.cfc
>     >> > ProcessInnerBean() method, if I dump the inner bean (after
>     line 184),
>     >> > I see the inner bean populated, but it's not getting set back
>     to the
>     >> > parent bean. I might be missing something, but in the
>     framework code I
>     >> > don't see any place inner bean getting set back to parent
>     bean after
>     >> > being populated (setBeanAutoFields).
>     >> >
>     >> > It's too late in the night, so, It just might be that I need
>     to get
>     >> > some sleep...
>     >> >
>     >> > Thanks!
>     >> > Sumit
>     >> >
>     >> > --
>     >> > You received this message because you are subscribed to
>     Mach-II for CFML
>     >> > list.
>     >> > To post to this group, send email to
>     >> > [email protected]
>     <mailto:[email protected]>
>     >> > To unsubscribe from this group, send email to
>     >> > [email protected]
>     <mailto:[email protected]>
>     >> > For more options, visit this group at
>     >> > http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>     >> >
>     >> > ***New URLs as of April 29th, 2010***
>     >> > SVN: http://svn.mach-ii.com/machii/
>     >> > Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
>     >> >
>     >>
>     >> --
>     >> You received this message because you are subscribed to Mach-II
>     for CFML
>     >> list.
>     >> To post to this group, send email to
>     >> [email protected]
>     <mailto:[email protected]>
>     >> To unsubscribe from this group, send email to
>     >> [email protected]
>     <mailto:[email protected]>
>     >> For more options, visit this group at
>     >> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>     >>
>     >> ***New URLs as of April 29th, 2010***
>     >> SVN: http://svn.mach-ii.com/machii/
>     >> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
>     >
>     > --
>     > You received this message because you are subscribed to Mach-II
>     for CFML
>     > list.
>     > To post to this group, send email to
>     [email protected]
>     <mailto:[email protected]>
>     > To unsubscribe from this group, send email to
>     > [email protected]
>     <mailto:[email protected]>
>     > For more options, visit this group at
>     > http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>     >
>     > ***New URLs as of April 29th, 2010***
>     > SVN: http://svn.mach-ii.com/machii/
>     > Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
>     >
>
>     --
>     You received this message because you are subscribed to Mach-II
>     for CFML list.
>     To post to this group, send email to
>     [email protected]
>     <mailto:[email protected]>
>     To unsubscribe from this group, send email to
>     [email protected]
>     <mailto:[email protected]>
>     For more options, visit this group at
>     http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>
>     ***New URLs as of April 29th, 2010***
>     SVN: http://svn.mach-ii.com/machii/
>     Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
>
>
> -- 
> You received this message because you are subscribed to Mach-II for
> CFML list.
> 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/mach-ii-for-coldfusion?hl=en
>  
> ***New URLs as of April 29th, 2010***
> SVN: http://svn.mach-ii.com/machii/
> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

-- 
You received this message because you are subscribed to Mach-II for CFML list.
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/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to