hi,

now i know what you mean, because i had the same 
problem and reported it as  https://issues.apache.org/jira/browse/TAP5-230 
:)

it is fixed in Tapestry 5.0.16

g,
kris





Imants Firsts <[EMAIL PROTECTED]> 
27.11.2008 18:14
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
Tapestry users <users@tapestry.apache.org>
Kopie

Thema
Re: Antwort: [T5] Bug in HibernateModule?







Adding ids to my services does not help. The problem occurs when 
HibernateModule is trying to contribute the default HibernateConfigurer, 
but is unable to look it up, because it does not specify which one is the 
default.

This is the code from HibernateModule:

public static void 
contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer> 
config, HibernateConfigurer defaultHibernateConfigurer) {
        config.add("Default", defaultHibernateConfigurer);
        config.addInstance("PackageName", 
PackageNameHibernateConfigurer.class);
}

Of course if there is only one HibernateConfigurer implementation then 
there is no problem.


Quoting Kristian Marinkovic <[EMAIL PROTECTED]>:
> not a bug.  this is correct behavior!
> 
> if you declare multiple ioc services with the same interface you have
> to qualifiy them with an id. otherwise the ioc container wont know which
> service instance of the HibernateConfigurer interface to inject
> 
> in your use case you could also contribute the HibernateConfigurer
> directly...
> 
> public void 
> 
contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer>
> 
> config, ObjectLocator locator)
> {
>     config.add(locator.proxy(HibernateConfigurer.class, 
> MyImplementation.class));
>     // or
>     config.add(locator.autobuild(MyOtherImplementation.class));
> }
> 
> g,
> kris
> 
> 
> 
> 
> Imants Firsts <[EMAIL PROTECTED]> 
> 27.11.2008 17:37
> Bitte antworten an
> "Tapestry users" <users@tapestry.apache.org>
> 
> 
> An
> users@tapestry.apache.org
> Kopie
> 
> Thema
> [T5] Bug in HibernateModule?
> 
> 
> 
> 
> 
> 
> 
> Hi!
> 
> I am getting the following exception if I have a service in my
> application 
> that implements HibernateConfigurer and I contribute it to 
> HibernateSessionSource.
> 
> org.apache.tapestry5.ioc.internal.OperationException
> Service interface org.apache.tapestry5.hibernate.HibernateConfigurer is 
> matched by 3 services: DefaultHibernateConfigurer, 
> HibernateAdministration, HibernateInterceptorConfigurer. Automatic 
> dependency resolution requires that exactly one service implement the 
> interface.
> 
> The problem is fixed by adding the 
> @InjectService("DefaultHibernateConfigurer") annotation to the
> 
> contributeHibernateSessionSource defaultHibernateConfigurer parameter.
> 
> Current declaration:
> public static void 
> 
contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer>
> 
> config, HibernateConfigurer defaultHibernateConfigurer)
> 
> Fixed declaration:
> public static void 
> 
contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer>
> 
> config, @InjectService("DefaultHibernateConfigurer")
> HibernateConfigurer 
> defaultHibernateConfigurer)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to