Chapter 18. Finding Objects in Relational Databases

Would you rather be a whiteboard warrior or a paper pusher?

A common programming task is to find one or more objects that are currently stored in the database and bring them into memory. Perhaps you need to display a list of people who work in a department, enable your users to define search criteria used to list available inventory items, or implement a report. Although these sound like easy tasks, there are many interesting implementation options and issues that you need to be aware of.

This chapter describes:

  • The role of the agile DBA

  • Find strategies

  • Implementation techniques

  • Representing find results

The Role of the Agile DBA

The role of agile DBAs is fairly straightforward: they will work with, and mentor, application developers in the techniques and issues involved with finding the data stored in RDBs.

Find Strategies

For the sake on convenience, I use the term find strategy to refer to your implementation strategy for finding the data representing objects within relational databases. The deciding factor in choosing a find strategy is the level of database encapsulation that you wish to have. In Chapter 13, we discussed four basic approaches for implementing database access, namely brute force, data access objects (DAOs), persistence frameworks, and services. Similarly, there are different find strategies that you may choose from: brute force, query objects, and meta data-driven.

Brute Force (Embedded SQL)

With the brute-force find strategy, ...

Get Agile Database Techniques: Effective Strategies for the Agile Software Developer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.