Hi Clint,

Thanks for the email. It's pretty cool what you are doing with the Spring
Bean Factory.

Another way you could provide this implementation without editing the Model
Glue core files, (which will ruin your framework upgrade process), is to
put the modified GenericORMController in your application, then define the
controller in your application specific ColdSpring configuration file:

<controller id="modelglue.orm.ormController"
type="Clint.Shiny.New.Path.For.ModelGlue.gesture.modules.orm.controller.GenericORMController"
 >
<message-listener message="onRequestStart" function="onRequestStart" />
 <message-listener message="modelglue.onApplicationStoredInScope"
function="loadORMAdapter" />
<message-listener message="modelglue.GenericCommit"
function="genericCommit" />
 <message-listener message="modelglue.GenericDelete"
function="genericDelete" />
<message-listener message="modelglue.GenericList" function="genericList" />
 <message-listener message="modelglue.GenericRead" function="genericRead" />
</controller>


When the application loads, the instance of ModelGlue will use your
controller, rather than the built in one. This is by design and will help
you keep your modifications out of the core framework.

This way, when we release 3.2, with all the cool new stuff, you can just
replace the ModelGlue directory entirely, and not worry about your
modifications being clobbered, or having to manually compare/port your
changes.

Try this and see if it works for you.


Dan Wilson


On Wed, Jul 4, 2012 at 9:27 PM, Clint <[email protected]> wrote:

> The GenericORMController has an issue when you set the
> ModelGlue_PARENT_BEAN_FACTORY (in site_root/index.cfm) to be an instance of
> a (Java) Spring BeanFactory (or PersistenceContext). This is pretty easy to
> do as ColdSpring provides a facade for this purpose.
>
> The issue in the GenericORMController occurs because that controller
> relies on a NoSuchBeanDefinitionException to be thrown when it queries the
> bean factory to determine if ORM support has been configured. As it turns
> out, Spring throws an exception with a different name, and if it's
> configured to be  a parent bean factory, Spring's BeanFactory will be the
> one throwing the NoSuchBeanDefinitionException.
>
> This little patch adds a check for Spring's exception for your
> consideration:
>
> --- ModelGlue/gesture/modules/orm/controller/GenericORMController.cfc
>  2010-03-04 18:53:28.000000000 -0600
> +++ ModelGlue/gesture/modules/orm/controller/GenericORMController.cfc
>   2012-07-03 22:12:44.000000000 -0500
> @@ -57,6 +57,9 @@
>                 <cfcatch type="coldspring.NoSuchBeanDefinitionException">
>                         <!--- No bean, no ORM.  --->
>                 </cfcatch>
> +               <cfcatch
> type="org.springframework.beans.factory.NoSuchBeanDefinitionException">
> +                       <!--- No bean in a Spring parent bean factory, no
> ORM. --->
> +               </cfcatch>
>                 <cfcatch type="BeanFactory.FileNotFound">
>                         <!--- Ditto for legacy apps using ChiliBeans --->
>                 </cfcatch>
>
>  --
> 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




-- 
Plutarch - "The mind is not a vessel to be filled but a fire to be kindled."

-- 
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

Reply via email to