private WebPageDao webPageDao = null;
public WebPageDao getWebPageDao() {
return webPageDao;
}
public void setWebPageDao(WebPageDao webPageDao) {
this.webPageDao = webPageDao;
}
public void testGetMaintenancePage() {
WebPage webPage = webPageDao.get(new Long(1));
WebPage.setInMaintenance(true);
try {
assertEquals(new Long(2L),webPage.getMaintenancePage().getId());
}
catch(MaintenancePageNotFoundException e) {
fail("Maintenance Page not found");
}
catch (WebPageInvalidStateException e) {
fail("WebPage must be in maintenance in order to get the
Maintenance
Page");
}
webPage = new WebPage();
webPage.setInMaintenance(false);
try {
webPage.getMaintenancePage()
fail("WebPage is not in maintenance, should had thrown
WebPageInvalidStateException");
}
catch (MaintenancePageNotFoundException e) {
fail("Maintenance Page not found");
}
catch (WebPageStateInvalidException e)
{
// expected exception.
assertNotNull(e);
}
}
*********************
Spring configuration:
*********************
<bean id="webPageDao"
class="com.quyne.lightcms.web.dao.hibernate.WebPageDaoHibernate">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
Michael Horwitz wrote:
>
> Hi Daniel,
>
> Could you post an example/code segment from one of your tests? It looks
> like
> you may be trying to do something out of a transaction - unfortunately the
> transaction beastie is needed for reading as well as writing.......
>
> Mike.
>
> On 7/26/07, Daniel.Rodriguez <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> mraible wrote:
>> >
>> > Are you trying to do something outside of a transaction? That's the
>> > only thing I can think of that might be causing this problem.
>> >
>> > Matt
>> >
>> >
>>
>> Not that I'm aware of.
>>
>> I'm not trying to save anything to the db. I'm just trying to transverse
>> the object graph. (check my prev. post) I find it easier than using a
>> HQL
>> query, cause many of our clients use MySQL 3.23, which leave us without
>> support for nested queries, which are used heavily by Hibernate.
>>
>> Perhaps as you can tell from my previous posts, I'm fairly new to the
>> whole
>> ORM scene, so I'm not as well versed in Hibernate as I wished.
>> --
>> View this message in context:
>> http://www.nabble.com/LazyInitializationException%3A-illegal-access-to-loading-collection....-tf4152650s2369.html#a11815549
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/LazyInitializationException%3A-illegal-access-to-loading-collection....-tf4152650s2369.html#a11819467
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]