Skip to main content
Top

2016 | OriginalPaper | Chapter

11. Filtering the Results of Searches

Authors : Joseph B. Ottinger, Jeff Linwood, Dave Minter

Published in: Beginning Hibernate

Publisher: Apress

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

Your application will often need to process only a subset of the data in the database tables. In these cases, you can create a Hibernate filter to eliminate the unwanted data. Filters provide a way for your application to limit the results of a query to data that passes the filter’s criteria. Filters are not a new concept — you can achieve much the same effect using SQL database views or, well, named queries — but Hibernate offers a centralized management system for them.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Footnotes
1
Query data are the methods that retrieved users would have to keep track of the specific criteria in question. To some degree, this is going to be necessary anyway, but we’d prefer the impact be as small as possible. Of course, there’s always the Criteria API we mentioned in Chapter 10
 
2
In this, it’s like JNDI; you refer to a name in the filter definition, but the filter itself is defined elsewhere.
 
3
We could anticipate multiple database engines, but most environments use the same databases for testing and production, as they should. It’s a good habit to follow.
 
4
A better example might have been a constant status, instead of “name ends with a 1,” but the status is ideally parameterized as well. The data model would have been polluted without a contrived example, so that’s what we have.
 
Metadata
Title
Filtering the Results of Searches
Authors
Joseph B. Ottinger
Jeff Linwood
Dave Minter
Copyright Year
2016
Publisher
Apress
DOI
https://doi.org/10.1007/978-1-4842-2319-2_11

Premium Partner