Accessing an EJB’s Environment

One of the questions that new EJB developers are always asking is how to provide configuration properties and values to an enterprise bean. Because enterprise beans are not supposed to access the file system, how does an enterprise bean get access to general configuration properties?

When we say configuration properties, we’re talking about properties that help enforce business rules. An example might be the maximum number of auctions a user can participate in. There are many different ways to give this data to the enterprise that needs it. We could hard-code it inside the bean, but that’s not a very flexible solution. We could store it into a database, but in some cases that’s overkill and too much trouble. Another ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 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.