-->
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.  [ 3 posts ] 
Author Message
 Post subject: Active flag on domain objects
PostPosted: Wed Jun 08, 2005 11:53 pm 
Newbie

Joined: Mon Aug 02, 2004 3:02 pm
Posts: 15
I have implemented an active flag on certain domain objects which can be turned "off" from the web side. When they are deactivated, this means that any access to them should be denied EXCEPT when I explicitly ask for inactive objects; any object that is linked to that domain object should only get active objects (e.g. object a has a collection of object b and obj b can be toggled active/inactive, so object a should automatically only get active b's).

I was wondering how people are implementing this. I have added a "where" class attribute to the object's mapping and this works, but there is no way in Hibernate, aside from using a native SQL query, to retrieve the inactive objects (if, for example, the object needs to be re-activated). Is there a better way to do this? I have looked at filters, but they don't seem to accomplish what I need either because you cannot turn them on all the time. So is the native SQL the best way to go?

Thanks for any help or insight,

Rexxe


Hibernate version: 3.0.5

Mapping documents:
Code:
<class name="foo.Company" where="active">

Code:
<property name="active" type="java.lang.Boolean" update="true"
         insert="true" column="active" not-null="true" />


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2005 12:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
This to me is a entry in the DAO layer to collect the appropriate data based on an argument of Active boolean. I try not to use advance mappings if a simple coded solution is easy enough to achive.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2005 1:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
look at hibernate 3 filters

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.