beautypg.com

Enterprise objects, What is an enterprise object, Chapter 3 – Apple WebObjects 5 User Manual

Page 25: 3 enterprise objects

background image

What Is an Enterprise Object?

25

Apple Computer, Inc. January 2002

C H A P T E R 3

3

Enterprise Objects

As mentioned in

“What Is WebObjects?”

(page 13), WebObjects applications gain

much of their usefulness by interacting with a persistent data store, that is, a
datasource, which is usually a database. In WebObjects, database tables are
represented as collections of Java classes called

enterprise objects

. Enterprise

objects contain the bulk of your application’s

business logic

, the part of the

application you write regardless of which of the four approaches you take.

This chapter introduces enterprise objects, describes how they map to a database,
outlines how WebObjects supports and interacts with them, and enumerates the
advantages of the Enterprise Objects approach over other approaches available in
the industry. You may wish to read the first section,

“What Is an Enterprise Object?”

(page 25), and the last section,

“The Enterprise Objects Advantage”

(page 34), and

skip the rest of the chapter, which is written for those familiar with relational
databases.

What Is an Enterprise Object?

An enterprise object is like any other object in that it couples data with the methods
for operating on that data. However, an enterprise object class has certain
characteristics that distinguish it from other classes:

It has properties that map to stored or persistent data; an enterprise object
instance typically corresponds to a single row or record in a database table.

It knows how to interact with other parts of WebObjects to give and receive
values for its properties. This is done through a mechanism known as key-value
coding

, which enables the setting and getting of these properties.