A method, system and program product for providing domain level business object
keys in Enterprise JavaBeans (EJB) applications. An instance of an EntityBean object
is provided with both a primary key and a domain key class. The primary key class
is associated with a home selected for the EntityBean object, and the domain key
class is associated with a particular business application within which the EntityBean
object is being utilized. The EntityBean and associated home is utilized across
different business applications, while ensuring uniqueness across the different
applications. Also, a common interface for the primary key is introduced that has
methods, which (1) provide an initialized instance of associated domain key classes
from a concrete primary key subclass, wherein a concrete primary key subclass knows
its associated domain key and is able to initialize the domain key from a subset
of attributes of the primary key, and (2) creates an initialized instance of a
primary key subclass from a given domain key and a context object.