Hey Group, I am SUPER enjoying the new ColdSpring 2. A really great piece of work.
I have an approach question for you smart developers, and I'll use the model of a Blog to illustrate:
1. I'm in the middle of saving a Post object. 2. I want to check which Blog the post belongs to so I get it using post.getBlog(). 3. Because I'm getting the Blog object from the Posts object graph, it isn't "wired" with its dependencies because I'm not getting it from the SessionWrapper which is using the BeanInjector for my transients.
To fix the situation: in my Blog objects init method I'm setting the dependencies by reaching out to CS (in the application scope) and getting the beans from there. While this works fine, and still follows the single point of access pattern, I just don't like the approach that much.
Anyone else have a similar situation and another way around it?
> Hey Group, > I am SUPER enjoying the new ColdSpring 2. A really great piece of work.
> I have an approach question for you smart developers, and I'll use the > model of a Blog to illustrate:
> 1. I'm in the middle of saving a Post object. > 2. I want to check which Blog the post belongs to so I get it using > post.getBlog(). > 3. Because I'm getting the Blog object from the Posts object graph, it > isn't "wired" with its dependencies because I'm not getting it from the > SessionWrapper which is using the BeanInjector for my transients.
> To fix the situation: in my Blog objects init method I'm setting the > dependencies by reaching out to CS (in the application scope) and getting > the beans from there. While this works fine, and still follows the single > point of access pattern, I just don't like the approach that much.
> Anyone else have a similar situation and another way around it?
Thanks for the suggestion and I have tried that, but I'm finding an issue which seems like odd behavior for ORM.
In postLoad() I'm using the beanInjector to wire up the entity, BUT the entity that is finally returned from ORM is NOT being wired. Matter of fact, I can't modify the entity at all in the EventHandler.
I would think that the entity being passed to the postLoad() is the same entity that is returned form ORM. Maybe I'm crazy.
On Thu, Dec 8, 2011 at 2:19 PM, Tony Nelson <tonynelso...@gmail.com> wrote: > You could use a global ORM EventHandler to inject the dependencies > using either a preLoad() or postLoad() event.
> On Dec 8, 1:15 pm, John Allen <johnfal...@gmail.com> wrote: > > Hey Group, > > I am SUPER enjoying the new ColdSpring 2. A really great piece of work.
> > I have an approach question for you smart developers, and I'll use the > > model of a Blog to illustrate:
> > 1. I'm in the middle of saving a Post object. > > 2. I want to check which Blog the post belongs to so I get it using > > post.getBlog(). > > 3. Because I'm getting the Blog object from the Posts object graph, it > > isn't "wired" with its dependencies because I'm not getting it from > the > > SessionWrapper which is using the BeanInjector for my transients.
> > To fix the situation: in my Blog objects init method I'm setting the > > dependencies by reaching out to CS (in the application scope) and getting > > the beans from there. While this works fine, and still follows the single > > point of access pattern, I just don't like the approach that much.
> > Anyone else have a similar situation and another way around it?
> > Thanks > > John Allen
> -- > You received this message because you are subscribed to the Google Groups > "ColdSpring-Users" group. > To post to this group, send email to coldspring-users@googlegroups.com. > To unsubscribe from this group, send email to > coldspring-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/coldspring-users?hl=en.
On Thu, Dec 8, 2011 at 3:10 PM, John Allen <johnfal...@gmail.com> wrote: > Thanks for the suggestion and I have tried that, but I'm finding an issue > which seems like odd behavior for ORM.
> In postLoad() I'm using the beanInjector to wire up the entity, BUT the > entity that is finally returned from ORM is NOT being wired. Matter of > fact, I can't modify the entity at all in the EventHandler.
> I would think that the entity being passed to the postLoad() is the same > entity that is returned form ORM. Maybe I'm crazy.
> On Thu, Dec 8, 2011 at 2:19 PM, Tony Nelson <tonynelso...@gmail.com>wrote:
>> You could use a global ORM EventHandler to inject the dependencies >> using either a preLoad() or postLoad() event.
>> On Dec 8, 1:15 pm, John Allen <johnfal...@gmail.com> wrote: >> > Hey Group, >> > I am SUPER enjoying the new ColdSpring 2. A really great piece of work.
>> > I have an approach question for you smart developers, and I'll use the >> > model of a Blog to illustrate:
>> > 1. I'm in the middle of saving a Post object. >> > 2. I want to check which Blog the post belongs to so I get it using >> > post.getBlog(). >> > 3. Because I'm getting the Blog object from the Posts object graph, >> it >> > isn't "wired" with its dependencies because I'm not getting it from >> the >> > SessionWrapper which is using the BeanInjector for my transients.
>> > To fix the situation: in my Blog objects init method I'm setting the >> > dependencies by reaching out to CS (in the application scope) and >> getting >> > the beans from there. While this works fine, and still follows the >> single >> > point of access pattern, I just don't like the approach that much.
>> > Anyone else have a similar situation and another way around it?
>> > Thanks >> > John Allen
>> -- >> You received this message because you are subscribed to the Google Groups >> "ColdSpring-Users" group. >> To post to this group, send email to coldspring-users@googlegroups.com. >> To unsubscribe from this group, send email to >> coldspring-users+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/coldspring-users?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "ColdSpring-Users" group. > To post to this group, send email to coldspring-users@googlegroups.com. > To unsubscribe from this group, send email to > coldspring-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/coldspring-users?hl=en.
On Fri, Dec 9, 2011 at 8:10 AM, John Allen <johnfal...@gmail.com> wrote: > Thanks for the suggestion and I have tried that, but I'm finding an issue > which seems like odd behavior for ORM.
> In postLoad() I'm using the beanInjector to wire up the entity, BUT the > entity that is finally returned from ORM is NOT being wired. Matter of > fact, I can't modify the entity at all in the EventHandler.
> I would think that the entity being passed to the postLoad() is the same > entity that is returned form ORM. Maybe I'm crazy.
> On Thu, Dec 8, 2011 at 2:19 PM, Tony Nelson <tonynelso...@gmail.com>wrote:
>> You could use a global ORM EventHandler to inject the dependencies >> using either a preLoad() or postLoad() event.
>> On Dec 8, 1:15 pm, John Allen <johnfal...@gmail.com> wrote: >> > Hey Group, >> > I am SUPER enjoying the new ColdSpring 2. A really great piece of work.
>> > I have an approach question for you smart developers, and I'll use the >> > model of a Blog to illustrate:
>> > 1. I'm in the middle of saving a Post object. >> > 2. I want to check which Blog the post belongs to so I get it using >> > post.getBlog(). >> > 3. Because I'm getting the Blog object from the Posts object graph, >> it >> > isn't "wired" with its dependencies because I'm not getting it from >> the >> > SessionWrapper which is using the BeanInjector for my transients.
>> > To fix the situation: in my Blog objects init method I'm setting the >> > dependencies by reaching out to CS (in the application scope) and >> getting >> > the beans from there. While this works fine, and still follows the >> single >> > point of access pattern, I just don't like the approach that much.
>> > Anyone else have a similar situation and another way around it?
>> > Thanks >> > John Allen
>> -- >> You received this message because you are subscribed to the Google Groups >> "ColdSpring-Users" group. >> To post to this group, send email to coldspring-users@googlegroups.com. >> To unsubscribe from this group, send email to >> coldspring-users+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/coldspring-users?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "ColdSpring-Users" group. > To post to this group, send email to coldspring-users@googlegroups.com. > To unsubscribe from this group, send email to > coldspring-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/coldspring-users?hl=en.
> What dependency are you looking to inject? Some sort of Service object, or > something else?
> Mark
> On Fri, Dec 9, 2011 at 8:10 AM, John Allen <johnfal...@gmail.com> wrote:
>> Thanks for the suggestion and I have tried that, but I'm finding an issue >> which seems like odd behavior for ORM.
>> In postLoad() I'm using the beanInjector to wire up the entity, BUT the >> entity that is finally returned from ORM is NOT being wired. Matter of >> fact, I can't modify the entity at all in the EventHandler.
>> I would think that the entity being passed to the postLoad() is the same >> entity that is returned form ORM. Maybe I'm crazy.
>> On Thu, Dec 8, 2011 at 2:19 PM, Tony Nelson <tonynelso...@gmail.com>wrote:
>>> You could use a global ORM EventHandler to inject the dependencies >>> using either a preLoad() or postLoad() event.
>>> On Dec 8, 1:15 pm, John Allen <johnfal...@gmail.com> wrote: >>> > Hey Group, >>> > I am SUPER enjoying the new ColdSpring 2. A really great piece of work.
>>> > I have an approach question for you smart developers, and I'll use the >>> > model of a Blog to illustrate:
>>> > 1. I'm in the middle of saving a Post object. >>> > 2. I want to check which Blog the post belongs to so I get it using >>> > post.getBlog(). >>> > 3. Because I'm getting the Blog object from the Posts object graph, >>> it >>> > isn't "wired" with its dependencies because I'm not getting it from >>> the >>> > SessionWrapper which is using the BeanInjector for my transients.
>>> > To fix the situation: in my Blog objects init method I'm setting the >>> > dependencies by reaching out to CS (in the application scope) and >>> getting >>> > the beans from there. While this works fine, and still follows the >>> single >>> > point of access pattern, I just don't like the approach that much.
>>> > Anyone else have a similar situation and another way around it?
>>> > Thanks >>> > John Allen
>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "ColdSpring-Users" group. >>> To post to this group, send email to coldspring-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> coldspring-users+unsubscribe@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/coldspring-users?hl=en.
>> -- >> You received this message because you are subscribed to the Google Groups >> "ColdSpring-Users" group. >> To post to this group, send email to coldspring-users@googlegroups.com. >> To unsubscribe from this group, send email to >> coldspring-users+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/coldspring-users?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "ColdSpring-Users" group. > To post to this group, send email to coldspring-users@googlegroups.com. > To unsubscribe from this group, send email to > coldspring-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/coldspring-users?hl=en.
On Thu, Dec 8, 2011 at 4:52 PM, John Allen <johnfal...@gmail.com> wrote: > @Mark OOPS! No I was just using the BeanInjector. Didn't see > BeanInjectorEventHandler!
> BeanInjectorEventHandler works like a champ! And yes, I was inserting > Service/Config objects. I like me some smart domain objects.
> Maybe next time I'll _really_ try to read the documentation.
> Thanks!
> On Thu, Dec 8, 2011 at 4:14 PM, Mark Mandel <mark.man...@gmail.com> wrote:
>> What dependency are you looking to inject? Some sort of Service object, >> or something else?
>> Mark
>> On Fri, Dec 9, 2011 at 8:10 AM, John Allen <johnfal...@gmail.com> wrote:
>>> Thanks for the suggestion and I have tried that, but I'm finding an >>> issue which seems like odd behavior for ORM.
>>> In postLoad() I'm using the beanInjector to wire up the entity, BUT the >>> entity that is finally returned from ORM is NOT being wired. Matter of >>> fact, I can't modify the entity at all in the EventHandler.
>>> I would think that the entity being passed to the postLoad() is the same >>> entity that is returned form ORM. Maybe I'm crazy.
>>> On Thu, Dec 8, 2011 at 2:19 PM, Tony Nelson <tonynelso...@gmail.com>wrote:
>>>> You could use a global ORM EventHandler to inject the dependencies >>>> using either a preLoad() or postLoad() event.
>>>> On Dec 8, 1:15 pm, John Allen <johnfal...@gmail.com> wrote: >>>> > Hey Group, >>>> > I am SUPER enjoying the new ColdSpring 2. A really great piece of >>>> work.
>>>> > I have an approach question for you smart developers, and I'll use the >>>> > model of a Blog to illustrate:
>>>> > 1. I'm in the middle of saving a Post object. >>>> > 2. I want to check which Blog the post belongs to so I get it using >>>> > post.getBlog(). >>>> > 3. Because I'm getting the Blog object from the Posts object >>>> graph, it >>>> > isn't "wired" with its dependencies because I'm not getting it >>>> from the >>>> > SessionWrapper which is using the BeanInjector for my transients.
>>>> > To fix the situation: in my Blog objects init method I'm setting the >>>> > dependencies by reaching out to CS (in the application scope) and >>>> getting >>>> > the beans from there. While this works fine, and still follows the >>>> single >>>> > point of access pattern, I just don't like the approach that much.
>>>> > Anyone else have a similar situation and another way around it?
>>>> > Thanks >>>> > John Allen
>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "ColdSpring-Users" group. >>>> To post to this group, send email to coldspring-users@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> coldspring-users+unsubscribe@googlegroups.com. >>>> For more options, visit this group at >>>> http://groups.google.com/group/coldspring-users?hl=en.
>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "ColdSpring-Users" group. >>> To post to this group, send email to coldspring-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> coldspring-users+unsubscribe@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/coldspring-users?hl=en.
>> -- >> You received this message because you are subscribed to the Google Groups >> "ColdSpring-Users" group. >> To post to this group, send email to coldspring-users@googlegroups.com. >> To unsubscribe from this group, send email to >> coldspring-users+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/coldspring-users?hl=en.