-->
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: Make hibernate ignore some records
PostPosted: Thu Aug 07, 2008 10:19 pm 
Newbie

Joined: Wed Aug 06, 2008 11:42 pm
Posts: 2
Hey folks

I am new to Hibernate but need to fix some systems wrote with it fast. But dunno even what keyword to use in google :(
I was wondering with the mapping file, there is a way to make hibernate simply ignore some records based on a criteria, like they were never there in the first place. My criteria would be: ignore all records where on myIntegerColumn value is different than 0.
My first instinct was to use a view on the dbms, but that is a mysql 4 that doesn't support such feature, and migrating to mysql 5 is not an option.

Any help is appreciate,

thanks


Greg


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 07, 2008 11:44 pm 
Newbie

Joined: Tue Aug 05, 2008 10:51 am
Posts: 1
have a look in filtering data in the reference guide
bye


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 08, 2008 2:32 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
The <class> tag in the mapping files can have a "where" attribute that, according to the documentation, can be used to:

Quote:
specify an arbitrary SQL WHERE condition to be used when retrieving objects of this class
.

For more info see http://www.hibernate.org/hib_docs/v3/re ... tion-class

In your case, something like:
Code:
<class .... where="myIntegerColumn=0" ...>


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.