|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
LazyInitializationException in XXManagerTestCaseHi,
We have tried to rewrite the built-in UserManager of appfuse, and came up with our own UserManager. For the test case of our UserManager, given a code which accesses a collection field, it returns LazyInitializationException, i.e. user.getAccounts().get(0). The collection field is configured as FetchType.LAZY. Did I miss something here?? At the DAO test case, it works fine, (got some readings on AbstractTransactionalDataSourceSpringContext, and it seems like, this one solves the Lazy loading problem on the DAO test case), but when it comes to the Service test case, it fails, found out that BaseManagerTestCase extends the AbstractDependencyInjectionSpringContext and not the class DAO base test case uses. Does it matter? How come? Thanks. |
|
|
Re: LazyInitializationException in XXManagerTestCaseOn 5/3/07, ayan <heeroyuy08@...> wrote:
> > Hi, > > We have tried to rewrite the built-in UserManager of appfuse, and came up > with our own UserManager. For the test case of our UserManager, given a code > which accesses a collection field, it returns LazyInitializationException, > i.e. user.getAccounts().get(0). > > The collection field is configured as FetchType.LAZY. Did I miss something > here?? > > At the DAO test case, it works fine, (got some readings on > AbstractTransactionalDataSourceSpringContext, and it seems like, this one > solves the Lazy loading problem on the DAO test case), but when it comes to > the Service test case, it fails, found out that BaseManagerTestCase extends > the AbstractDependencyInjectionSpringContext and not the class DAO base test > case uses. Does it matter? How come? If I said the reason BaseManagerTestCase extends AbstractDependencyInjectionSpringContextTests instead of AbstractTransactionalDataSourceSpringContextTests was to show possible lazy-loading issues, would you believe me? ;-) If you're going to expose any of your service-layer objects through web services, you should probably initialize all the lazy collections in your DAO or Service layer. In the most recent version of AppFuse, we've removed the OpenSessionInViewFilter from web.xml. We did it to make it easier to use the same web.xml for any type of persistence framework. With that being said, I don't see a problem with using lazy-loading, so if you'd like us to change BaseManagerTestCase, please enter an issue in JIRA. We could also change it to extend AbstractAnnotationAwareTransactionalTests, which allows you to use annotations to indicate transactional methods. http://tinyurl.com/298vaw Matt > > Thanks. > -- > View this message in context: http://www.nabble.com/LazyInitializationException-in-XXManagerTestCase-tf3684711s2369.html#a10299277 > Sent from the AppFuse - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > -- http://raibledesigns.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: LazyInitializationException in XXManagerTestCaseGreat input Sir.
I haven't got deeper on the appfuse and spring, If I had time to look on those Spring Test classes, I'll try. ;-) My archi just decided to load the collection from the DAO and use it on Service layer test case, as you have suggest, we leave it out temporarily those mappings we have already created on our entities which lazy loads its collection. cheers, ayan
|
|
|
Re: LazyInitializationException in XXManagerTestCaseHi, Matt
On 5/3/07, Matt Raible <matt@...> wrote: > > If I said the reason BaseManagerTestCase extends > AbstractDependencyInjectionSpringContextTests instead of > AbstractTransactionalDataSourceSpringContextTests was to show possible > lazy-loading issues, would you believe me? ;-) > I ran across this when I bumped into another bug[1]. Showing possible lazy-loading issues kinda makes sense, though I'm using this class for something other than web services. Filed as APF-849. [1] http://issues.appfuse.org/browse/APF-848 [2] http://issues.appfuse.org/browse/APF-849 -- Ealden Esto E. Escañan http://ealden.net --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |