O'Reilly logo

Continuous Enterprise Development in Java by Aslak Knutsen, Andrew Lee Rubinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Java Persistence and Relational Data

“Energy and persistence conquer all things.” - Benjamin Franklin

If we really boil down the primary objective of most applications to bare metal, we’ll find that nearly everything we do involves an interaction with data. We supply it when we make a new online order. We pull it out when we research on a Wiki. We update it when we change our credit card’s billing address.

The information contained in a system at any point in time comprises the state of the application, and state comes in a variety of scopes, including:

Request

Limited access within one request/response cycle

Session

Limited access within one user session

Conversation/Sequence/Transaction

Limited access to a sequence of events (treated as one unit) within one user session

Application

Shared throughout the application

Environment

Shared throughout the host environment

Depending upon your view or framework of choice, there may be other ways to slice visibility, but the above table outlines some of the most commonly-used paradigms.

As is thematic throughout the study of computer science, the rule of thumb is to limit ourselves to the smallest scope required. Fine-grained access to data helps to ensure that we don’t leak out state where it can cause security issues or difficult-to-debug behaviors. Can you imagine what it’d be like if one user’s access to his online bank account were to be replicated to all active sessions?

In addition to the notion of scopes, which limit data’s visibility, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required