-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Advance onLoad event behavior ..
PostPosted: Tue Jul 26, 2005 9:53 am 
Newbie

Joined: Tue Jul 26, 2005 9:16 am
Posts: 3
Location: Madison, WI
Hibernate version: 3.0

I'm writing an application that requires a very granular authorization model. Every attribute as well as entities within the object tree can have authorization constraints assigned to them. The onLoad event will allow me to filter at the necessary level (prior to loading for performance reasons), but in the case of eager loading, it causes the load to entirely fail because a HibernateException must be thrown to prevent the load from continuing. I'm looking for a means to prevent a load silently. Below is an example:

public class Foo {

private Boo boo;
private Goo goo;

public Boo getBoo() { ...}
public void setBoo(Boo boo) { ... }

public Goo getGoo() { ... }
public void setGoo(Goo goo) { ... }

}

In the example of above, assume that the user has authorized access to Foo entities and Goo entities, but not Boo entities. If Boo and Goo are both eager loads, when the user attempts to load Foo, I would be forced to throw a HibernateException on the onLoad event for Boo. I would prefer to silently not load the entity instead. Thoughts?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 10:22 am 
Newbie

Joined: Tue Jul 26, 2005 9:16 am
Posts: 3
Location: Madison, WI
Okay, I think I've got it now. Since my listener will extend DefaultLoadEventListener, I can simply return null from my onLoad implementation when the object should not be loaded. Otherwise return super.onLoad(...) Can someone verify that?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.