This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Roo performance issue. FULL Database Loaded?

Apr 2nd, 2012, 10:30 AM

I'm having a show stopper issue with Roo/Spring/Tiles that I really hope someone can help me get past.
When I use the clinic.roo script with a minor change to accommodate security/user roles I am running into a Hibernate performance problem.

Recipe to reproduce with Roo 1.2.1.
Here is the slightly modified clinic script.

PROBLEM: If you create an Auth object and a couple Owners with a couple Pets when you view one Pet with /pets/1 you can see in the System Log that there will be lots of SQL that query the curricular references and load the full Database. I have all the related entities as FetchType.LAZY but they are still loaded even though they are not being shown on the page.

Code:

Hibernate:
select
pet0_.id as id3_1_,
pet0_.name as name3_1_,
pet0_.owner as owner3_1_,
pet0_.send_reminders as send3_3_1_,
pet0_.type as type3_1_,
pet0_.version as version3_1_,
pet0_.weight as weight3_1_,
owner1_.id as id0_0_,
owner1_.address as address0_0_,
owner1_.birth_day as birth4_0_0_,
owner1_.city as city0_0_,
owner1_.email as email0_0_,
owner1_.first_name as first7_0_0_,
owner1_.home_page as home8_0_0_,
owner1_.last_name as last9_0_0_,
owner1_.telephone as telephone0_0_,
owner1_.version as version0_0_
from
pet pet0_
left outer join
abstract_person owner1_
on pet0_.owner=owner1_.id
where
pet0_.id=?
Hibernate:
select
pets0_.owner as owner0_1_,
pets0_.id as id1_,
pets0_.id as id3_0_,
pets0_.name as name3_0_,
pets0_.owner as owner3_0_,
pets0_.send_reminders as send3_3_0_,
pets0_.type as type3_0_,
pets0_.version as version3_0_,
pets0_.weight as weight3_0_
from
pet pets0_
where
pets0_.owner=?
Hibernate:
select
roles0_.owners as owners0_1_,
roles0_.roles as roles1_,
auth1_.id as id1_0_,
auth1_.name as name1_0_,
auth1_.version as version1_0_
from
auth_owners roles0_
inner join
auth auth1_
on roles0_.roles=auth1_.id
where
roles0_.owners=?
Hibernate:
select
owners0_.roles as roles1_1_,
owners0_.owners as owners1_,
owner1_.id as id0_0_,
owner1_.address as address0_0_,
owner1_.birth_day as birth4_0_0_,
owner1_.city as city0_0_,
owner1_.email as email0_0_,
owner1_.first_name as first7_0_0_,
owner1_.home_page as home8_0_0_,
owner1_.last_name as last9_0_0_,
owner1_.telephone as telephone0_0_,
owner1_.version as version0_0_
from
auth_owners owners0_
inner join
abstract_person owner1_
on owners0_.owners=owner1_.id
where
owners0_.roles=?
Hibernate:
select
pets0_.owner as owner0_1_,
pets0_.id as id1_,
pets0_.id as id3_0_,
pets0_.name as name3_0_,
pets0_.owner as owner3_0_,
pets0_.send_reminders as send3_3_0_,
pets0_.type as type3_0_,
pets0_.version as version3_0_,
pets0_.weight as weight3_0_
from
pet pets0_
where
pets0_.owner=?
Hibernate:
select
roles0_.owners as owners0_1_,
roles0_.roles as roles1_,
auth1_.id as id1_0_,
auth1_.name as name1_0_,
auth1_.version as version1_0_
from
auth_owners roles0_
inner join
auth auth1_
on roles0_.roles=auth1_.id
where
roles0_.owners=?

When stepping through the debugger it seems that somewhere in JspTilesRequestContext is touching every property in the Hibernate Entity and causing recursive requests.