--- url: "https://martinfowler.com/eaaCatalog/queryObject.html" titulek: "Query Object" h1: "Query Object" popis: "An object that represents a database query." jazyk: "" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 21:08:56" znaku: 1109 slov: 175 kodovani: "utf-8" sha256: "c92f1318b1677964a93354f82f4a01ec1956918de28dba2a2dc1d1d586614942" --- # Query Object An object that represents a database query. SQL can be an involved language, and many developers aren't particularly familiar with it. Furthermore, you need to know what the database schema looks like to form queries. You can avoid this by creating specialized finder methods that hide the SQL inside parameterized methods, but that makes it dif-ficult to form more ad hoc queries. It also leads to duplication in the SQL state-ments should the database schema change. A Query Object is an interpreter, that is, a structure of objects that can form itself into a SQL query. You can create this query by referring to classes and fields rather than tables and columns. In this way those who write the queries can do so independently of the database schema and changes to the schema can be localized in a single place. for more details go to [Chapter 13](https://learning.oreilly.com/library/view/patterns-of-enterprise/0321127420/ch13.html#ch13lev1sec2) of the online ebook at oreilly.com This pattern is part of [Patterns of Enterprise Application Architecture](.) [Martin Fowler](/) 05 March 2003