Running your DAOs outside of a transaction is what's causing your lazy
exceptions. By extending the Spring classes, your test methods will be
wrapped in transactions. As for your Managers when running in Tomcat,
if they exist under the "service" package (at any level) and they end
in "Manager", their methods should be wrapped in transactions too.

Matt

On Fri, Aug 8, 2008 at 1:20 AM, Jonathan Dray <[EMAIL PROTECTED]> wrote:
> Hi Matt,
>
> Ok, I will try to extend the spring test class you suggested.
> But what about in my application ?
>
> As my manager doesn't extend an Appfuse manager class I'll probably have
> some errors .
> Do I have to define additional configuration options (transactions, lazy
> loading) in spring or hibernate configuration files ?
> If it is the case do you some examples on how to do this please ?
>
> Thank you.
> Best Regards,
>
> Jonathan Dray
>
>
> 2008/8/8 Matt Raible <[EMAIL PROTECTED]>
>>
>> You should change your test class to extend Spring's
>> AbstractTransactionalDataSourceSpringContextTests (or something like
>> that).
>>
>> Matt
>>
>> On Thu, Aug 7, 2008 at 5:34 PM, Jonathan Dray <[EMAIL PROTECTED]>
>> wrote:
>> > Hi,
>> >
>> > We are working with Appfuse and we really appreciate it.
>> > We have defined a custom manager that uses several daos.
>> > It does not extends any of appfuse manager classes.
>> >
>> > It perfectly works in a test case when the test class used extends one
>> > of
>> > Appfuse test classes available.
>> > We followed indications found in this thread :
>> >
>> > http://www.nabble.com/-Appfuse2.0--Best-Practise-Design-Pattern-for-Multiple-Dao-Access-from-managers-td14116309s2369.html#a14370264
>> >
>> > But, we get some errors when we try to test the same manager with a
>> > Junit or
>> > a Spring Test Case.
>> > The errors are about lazy loading.
>> >
>> > How should we define our custom manager so that it works without a
>> > specific
>> > appfuse context ?
>> > There must be some best practices to do this with appfuse. Could you
>> > please
>> > give us more information on how to handle this ?
>> >
>> > Thank you.
>> >
>> > Regards,
>> > Jonathan Dray
>> >
>>
>> ---------------------------------------------------------------------
>> 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