Hello everyone, I'm experiencing some odd behavior with my form crud. I'm
using tapestry-hibernate jpa which consist of a parent object and a bunch of
children objects. I'm using the following code to get my parent object. 

@Property
private PurchaseRequest pr;

@Property
private PrLogging prLogging;

    Class<?> onActivate(PurchaseRequest pr) {
        if (pr!= null) {
            roleManager = new RoleManager(pr, this.userInfo,
this.securityService);

            if (this.roleManager.hasPrAccess()) {
                this.pr = pr;
                return null;
            }
        }        
        
        return Index.class;
    }


Object onSuccess() {
        this.pr.getPrLoggings().add(new PrLogging(this.pr,
userInfo.getUser(), _action));
        session.saveOrUpdate(pr);
        return null;
}
My .tml has a code chunk that looks something like this. 

                <t:Loop value="prLogging" source="pr.prLoggings">
                    <div>${prLogging.label}</div>
                </t:Loop>

When my page renders for the first time it will grab all my pr. prLoggings
in a single query, however when I save the form, prior to onSuccess in
onActivate the form will initiate individual queries for each and every
child result, example will initiate 10 individual prLogging queries from the
pr before even getting to the onSuccess method. 

This only happens on save and not on page refresh, does anybody know what
might be going on. Am I using tapestry incorrectly or is this a hibernate
issue. I tried eager fetching which resolved the issue within the form, but
caused other performance issues within the list page containing all the prs. 

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Possible-n-1-hibernate-bug-with-tapestry-crud-tp5671389p5671389.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to