# com.beasys.commerce.foundation
EntityImpl Class

public class EntityImpl
extends `Object`
implements `EntityBean`, `RelationalReference`

This is the base implementation of the Business Smart Component (BSC) entity interface. For each BSC Entity derived interface, there will be a corresponding BSC EntityImpl with business methods that are mirrored. It also provides storage for an EntityContext and an implementation of the Set and Get Entity Context methods.

Related Topics

``Entity``

Hierarchy
  `Object`
  `EntityImpl`

All Implemented Interfaces
  `EnterpriseBean`, `EntityBean`, `RelationalReference`, `Serializable`

Direct Known Subclasses
  `ContactImpl`, `OrderImpl`, `PaymentTransactionImpl`, `ShippingMethodImpl`

## Field Summary

`public `String`` | `__classIdentifier` String
`public `SmartEntityReference`` | `__containingEntity` SmartEntityReference
`public `Object`` | `__mapKey` Object
`public `Long`` | `__sequenceNumber` Long
`public `EntityContext`` | `_ctx` EntityContext
`protected transient `Context`` | `_environmentNamingContext` Context
`protected transient `Hashtable`` | `_environmentPropertyCache` Hashtable
`public transient boolean` | `_isDirty` boolean
`protected transient `SmartBMP`` | `_smartBMP` SmartBMP

## Constructor Summary

EntityImpl() EntityImpl constructor.

## Method Summary

`protected void` | `bscInitializeAttributes`(`SmartKey` pk) Initialize this object's attributes.
`public void` | `clearRelationalBinding`(`String` attributeIdentifier, `Collection` collection)
`public void` | `clearRelationalBinding`(`String` attributeIdentifier, `Collection` collection, `Object` o)
`public void` | `clearRelationalBinding`(`String` attributeIdentifier, `Map` map, `Object` key)
`public void` | `clearRelationalBinding`(`String` attributeIdentifier, `Map` map)
`protected `Collection`` | `doRelationalBinding`(`String` attributeIdentifier, `Collection` collection) Add relational information to each element in a collection, AND synchronize the collection with the persistence cache This feature is implemented by a plugin and by default is turned off
`protected `Map`` | `doRelationalBinding`(`String` attributeIdentifier, `Map` map) Add relational information to each element in a map, AND synchronize the map with the persistence cache This feature is implemented by a plugin and by default is turned off
`protected `Object`` | `doRelationalBindingOnElement`(`String` attributeIdentifier, `Object` value) Add relational information to a dependent object.
`protected `Belonging`` | `doRelationalBindingOnElement`(`String` attributeIdentifier, `Belonging` value) Add relational information to a belonging This feature is implemented by a plugin and by default is turned off
`protected `EJBObject`` | `doRelationalBindingOnElement`(`String` attributeIdentifier, `EJBObject` value) Add relational information to an EJBObject This feature is implemented by a plugin and by default is turned off
`protected `Object`` | `doRelationalBindingOnSingleton`(`String` attributeIdentifier, `Object` value) Add relational information to a dependent object.
`protected `Belonging`` | `doRelationalBindingOnSingleton`(`String` attributeIdentifier, `Belonging` value) Add relational information to a belonging This feature is implemented by a plugin and by default is turned off
`protected `EJBObject`` | `doRelationalBindingOnSingleton`(`String` attributeIdentifier, `EJBObject` ejbObject) Add relational information to an EJBObject This feature is implemented by a plugin and by default is turned off
`protected `Object`` | `doRelationalBindingWithMapKey`(`String` attributeIdentifier, `Object` object, `Object` key) Add relational information to an element in a map, AND synchronize the element with the persistence cache This feature is implemented by a plugin and by default is turned off
`protected `EJBObject`` | `doRelationalBindingWithMapKey`(`String` attributeIdentifier, `EJBObject` ejbObject, `Object` key) Add relational information to an element in a map, AND synchronize the element with the persistence cache This feature is implemented by a plugin and by default is turned off
`protected `Object`` | `doRelationalBindingWithMapKey`(`String` attributeIdentifier, `Belonging` belonging, `Object` key) Add relational information to an element in a map, AND synchronize the element with the persistence cache This feature is implemented by a plugin and by default is turned off
`public void` | `ejbActivate`() ejbActivate method.
`public `SmartKey`` | `ejbCreate`(`SmartKey` pk) ejbCreate method.
`public `Enumeration`` | `ejbFindAll`() ejbFindAll method.
`public `SmartKey`` | `ejbFindByPrimaryKey`(`SmartKey` pk) ejbFindByPrimaryKey method.
`public void` | `ejbLoad`() ejbLoad method.
`public void` | `ejbPassivate`() ejbPassivate method.
`public void` | `ejbPostCreate`(`SmartKey` key) ejbPostCreate method.
`public void` | `ejbRemove`() ejbRemove method.
`public void` | `ejbStore`() ejbStore method.
`protected `Collection`` | `enumerateRelationalBinding`(`String` attributeIdentifier, `Collection` collection) Add relational information to each element in a collection, but do not synchronize the collection with the persistence cache This feature is implemented by a plugin and by default is turned off
`protected `Map`` | `enumerateRelationalBinding`(`String` attributeIdentifier, `Map` map) Add relational information to each element in a map, but do not synchronize the map with the persistence cache This feature is implemented by a plugin and by default is turned off
`public `String`` | `get__classIdentifier`() Get class identifier for this object (used to persist subclasses in a single collection or map)
`public `Belonging`` | `get__containingBelonging`() Get foreign key information about the bean that contains this object
`public `EJBObject`` | `get__containingEntity`() Get foreign key information about the bean that contains this object
`public `SmartEntityReference`` | `get__containingEntityReference`()
`public `Object`` | `get__mapKey`() get map key
`public `Long`` | `get__sequenceNumber`() Get the sequencer number
`public `EntityContext`` | `getEntityContext`() getEntityContext method.
`protected `Context`` | `getEnvironmentNamingContext`() Returns the bean's environment naming context.
`public `Object`` | `getEnvironmentProperty`(`String` propertyName) This method returns the value of the specified environment property.
`public `Object`` | `getEnvironmentProperty`(`String` propertyName, `Object` defaultValue) This method returns the value of the specified environment property or the specified default value if the environment property is not found.
`protected `Hashtable`` | `getEnvironmentPropertyCache`() Returns the bean's environment property cache
`public `PersistenceHelperPlugin`` | `getPersistenceHelperPlugin`() Returns a PersistenceHelperPlugin object for the entity bean.
`protected `SmartBMP`` | `getSmartBMP`() Returns the smartBMP cache.
`protected `SmartBMP`` | `initSmartBMP`() Attempts to initialize the SmartBMP cached information by looking up "SmartBMPClass" in the environment properties.
`public boolean` | `isModified`() This method is used by some containers to evaluate if the bean has been modified and it must be persisted.
`protected void` | `set__classIdentifier`(`String` classIdentifier) Derived classes use this to set the class identifier
`public void` | `set__containingBelonging`(`Belonging` belonging) Provides foreign key information about the bean that contains this object
`public void` | `set__containingEntity`(`EJBObject` containingEntity) Provides foreign key information about the bean that contains this object
`public void` | `set__containingEntityReference`(`SmartEntityReference` smartEntityReference)
`public void` | `set__mapKey`(`Object` mapKey) Provides map key information
`public void` | `setEntityContext`(`EntityContext` ctx) setEntityContext method.
`public void` | `unsetEntityContext`() unsetEntityContext method.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.ejb.`EntityBean``
`ejbActivate, ejbLoad, ejbPassivate, ejbRemove, ejbStore, setEntityContext, unsetEntityContext`

Methods from interface `com.beasys.commerce.foundation.`RelationalReference``
``get__classIdentifier`, `get__containingBelonging`, `get__containingEntity`, `get__mapKey`, `get__sequenceNumber`, `set__containingBelonging`, `set__containingEntity`, `set__mapKey``

## Field Detail

### __classIdentifier

    public String __classIdentifier

### __containingEntity

    public SmartEntityReference __containingEntity

### __mapKey

    public Object __mapKey

### __sequenceNumber

    public Long __sequenceNumber

### _ctx

    public EntityContext _ctx

### _environmentNamingContext

    protected transient Context _environmentNamingContext

### _environmentPropertyCache

    protected transient Hashtable _environmentPropertyCache

### _isDirty

    public transient boolean _isDirty

### _smartBMP

    protected transient SmartBMP _smartBMP

## Constructor Detail

### EntityImpl

    public EntityImpl()

  EntityImpl constructor.

## Method Detail

### bscInitializeAttributes(SmartKey) Method

    protected void bscInitializeAttributes(SmartKey pk)
         throws CreateException

Initialize this object's attributes.

#### Exceptions

``CreateException``

### clearRelationalBinding(String, Collection) Method

    public void clearRelationalBinding(String attributeIdentifier,
                                       Collection collection)

### clearRelationalBinding(String, Collection, Object) Method

    public void clearRelationalBinding(String attributeIdentifier,
                                       Collection collection,
                                       Object o)

### clearRelationalBinding(String, Map, Object) Method

    public void clearRelationalBinding(String attributeIdentifier,
                                       Map map,
                                       Object key)

### clearRelationalBinding(String, Map) Method

    public void clearRelationalBinding(String attributeIdentifier,
                                       Map map)

### doRelationalBinding(String, Collection) Method

    protected Collection doRelationalBinding(String attributeIdentifier,
                                             Collection collection)

Add relational information to each element in a collection, AND synchronize the collection with the persistence cache This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

collection
  the target collection

#### Returns

the input collection

### doRelationalBinding(String, Map) Method

    protected Map doRelationalBinding(String attributeIdentifier,
                                      Map map)

Add relational information to each element in a map, AND synchronize the map with the persistence cache This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

map
  the target map

#### Returns

the input map

### doRelationalBindingOnElement(String, Object) Method

    protected Object doRelationalBindingOnElement(String attributeIdentifier,
                                                  Object value)

Add relational information to a dependent object. This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

value
  instance of a dependent object

#### Returns

the input value with relational information added.

### doRelationalBindingOnElement(String, Belonging) Method

    protected Belonging doRelationalBindingOnElement(String attributeIdentifier,
                                                     Belonging value)

Add relational information to a belonging This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

value
  instance of a belonging

#### Returns

the input value, with relational inforamtion added.

### doRelationalBindingOnElement(String, EJBObject) Method

    protected EJBObject doRelationalBindingOnElement(String attributeIdentifier,
                                                     EJBObject value)

Add relational information to an EJBObject This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

value
  instance of an EJB object

#### Returns

the input value, with relational information added.

### doRelationalBindingOnSingleton(String, Object) Method

    protected Object doRelationalBindingOnSingleton(String attributeIdentifier,
                                                    Object value)

Add relational information to a dependent object. This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

value
  instance of a dependent object

#### Returns

the input value with relational information added.

### doRelationalBindingOnSingleton(String, Belonging) Method

    protected Belonging doRelationalBindingOnSingleton(String attributeIdentifier,
                                                       Belonging value)

Add relational information to a belonging This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

value
  instance of a belonging

#### Returns

the input value, with relational inforamtion added.

### doRelationalBindingOnSingleton(String, EJBObject) Method

    protected EJBObject doRelationalBindingOnSingleton(String attributeIdentifier,
                                                       EJBObject ejbObject)

Add relational information to an EJBObject This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

ejbObject
  instance of an EJB object

#### Returns

the input value, with relational information added.

### doRelationalBindingWithMapKey(String, Object, Object) Method

    protected Object doRelationalBindingWithMapKey(String attributeIdentifier,
                                                   Object object,
                                                   Object key)

Add relational information to an element in a map, AND synchronize the element with the persistence cache This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

object
  the target collection

#### Returns

the input collection

### doRelationalBindingWithMapKey(String, EJBObject, Object) Method

    protected EJBObject doRelationalBindingWithMapKey(String attributeIdentifier,
                                                      EJBObject ejbObject,
                                                      Object key)

Add relational information to an element in a map, AND synchronize the element with the persistence cache This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

ejbObject
  the target collection

#### Returns

the input collection

### doRelationalBindingWithMapKey(String, Belonging, Object) Method

    protected Object doRelationalBindingWithMapKey(String attributeIdentifier,
                                                   Belonging belonging,
                                                   Object key)

Add relational information to an element in a map, AND synchronize the element with the persistence cache This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

belonging
  the target collection

#### Returns

the input collection

### ejbActivate() Method

    public void ejbActivate()
         throws EJBException

ejbActivate method.

#### Exceptions

``EJBException``

### ejbCreate(SmartKey) Method

    public SmartKey ejbCreate(SmartKey pk)
         throws CreateException, EJBException

ejbCreate method.

#### Exceptions

``CreateException``
``EJBException``

### ejbFindAll() Method

    public Enumeration ejbFindAll()
         throws FinderException, EJBException

ejbFindAll method.

#### Exceptions

``FinderException``
``EJBException``

### ejbFindByPrimaryKey(SmartKey) Method

    public SmartKey ejbFindByPrimaryKey(SmartKey pk)
         throws FinderException, EJBException

ejbFindByPrimaryKey method.

#### Exceptions

``FinderException``
``EJBException``

### ejbLoad() Method

    public void ejbLoad()
         throws EJBException

ejbLoad method.

#### Exceptions

``EJBException``

### ejbPassivate() Method

    public void ejbPassivate()
         throws EJBException

ejbPassivate method.

#### Exceptions

``EJBException``

### ejbPostCreate(SmartKey) Method

    public void ejbPostCreate(SmartKey key)
         throws CreateException, EJBException

ejbPostCreate method.

#### Exceptions

``CreateException``
``EJBException``

### ejbRemove() Method

    public void ejbRemove()
         throws RemoveException, EJBException

ejbRemove method.

#### Exceptions

``RemoveException``
``EJBException``

### ejbStore() Method

    public void ejbStore()
         throws EJBException

ejbStore method.

#### Exceptions

``EJBException``

### enumerateRelationalBinding(String, Collection) Method

    protected Collection enumerateRelationalBinding(String attributeIdentifier,
                                                    Collection collection)

Add relational information to each element in a collection, but do not synchronize the collection with the persistence cache This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

collection
  the target collection

#### Returns

the input collection

### enumerateRelationalBinding(String, Map) Method

    protected Map enumerateRelationalBinding(String attributeIdentifier,
                                             Map map)

Add relational information to each element in a map, but do not synchronize the map with the persistence cache This feature is implemented by a plugin and by default is turned off

#### Parameters

attributeIdentifier
  identifier for an attribute on a bean e.g. examples.buybeans.BeanieHat.numberOfPropellers

map
  the target map

#### Returns

the input map

### get__classIdentifier() Method

    public String get__classIdentifier()

Get class identifier for this object (used to persist subclasses in a single collection or map)

#### Returns

class identifier for this object.

### get__containingBelonging() Method

    public Belonging get__containingBelonging()

Get foreign key information about the bean that contains this object

#### Returns

ejbObject remote interface of the containing bean

### get__containingEntity() Method

    public EJBObject get__containingEntity()

Get foreign key information about the bean that contains this object

#### Returns

ejbObject remote interface of the containing bean

### get__containingEntityReference() Method

    public SmartEntityReference get__containingEntityReference()

### get__mapKey() Method

    public Object get__mapKey()

Description copied from `RelationalReference.get__mapKey()`
get map key

#### Returns

the mak key

### get__sequenceNumber() Method

    public Long get__sequenceNumber()

Get the sequencer number

### getEntityContext() Method

    public EntityContext getEntityContext()

getEntityContext method.

### getEnvironmentNamingContext() Method

    protected Context getEnvironmentNamingContext()
         throws NamingException

Returns the bean's environment naming context.

#### Exceptions

``NamingException``

### getEnvironmentProperty(String) Method

    public Object getEnvironmentProperty(String propertyName)
         throws NamingException

This method returns the value of the specified environment property.

#### Exceptions

``NamingException``

### getEnvironmentProperty(String, Object) Method

    public Object getEnvironmentProperty(String propertyName,
                                         Object defaultValue)
         throws NamingException

This method returns the value of the specified environment property or the specified default value if the environment property is not found.

#### Exceptions

``NamingException``

### getEnvironmentPropertyCache() Method

    protected Hashtable getEnvironmentPropertyCache()

Returns the bean's environment property cache

### getPersistenceHelperPlugin() Method

    public PersistenceHelperPlugin getPersistenceHelperPlugin()

Returns a PersistenceHelperPlugin object for the entity bean. The PersistenceHelperPlugin created a new instance of the class defined by the "PersistenceHelperPlugin" environment property for the bean. If the environment property is not found, the "DefaultPersistenceHelperPlugin" value defined in the commerce.properties file is used to create the plugin.

#### Returns

PersistenceHelperPlugin specific class that implements PersistenceHelperPlugin or null, if no PersistenceHelperPlugin is specified.

### getSmartBMP() Method

    protected SmartBMP getSmartBMP()

Returns the smartBMP cache.

### initSmartBMP() Method

    protected SmartBMP initSmartBMP()
         throws SystemException

Attempts to initialize the SmartBMP cached information by looking up "SmartBMPClass" in the environment properties. If the "SmartBMPClass" property is found the method invokes the the SmartBMPFactory.createSmartBMP method to obtain the singleton instance and it caches it.

#### Exceptions

``SystemException``

### isModified() Method

    public boolean isModified()

This method is used by some containers to evaluate if the bean has been modified and it must be persisted.

### set__classIdentifier(String) Method

    protected void set__classIdentifier(String classIdentifier)

Derived classes use this to set the class identifier

### set__containingBelonging(Belonging) Method

    public void set__containingBelonging(Belonging belonging)

Provides foreign key information about the bean that contains this object

#### Parameters

belonging
  remote interface of the containing bean

### set__containingEntity(EJBObject) Method

    public void set__containingEntity(EJBObject containingEntity)

Provides foreign key information about the bean that contains this object

#### Parameters

containingEntity
  remote interface of the containing bean

### set__containingEntityReference(SmartEntityReference) Method

    public void set__containingEntityReference(SmartEntityReference smartEntityReference)

### set__mapKey(Object) Method

    public void set__mapKey(Object mapKey)

Description copied from `RelationalReference.set__mapKey(Object)`
Provides map key information

#### Parameters

mapKey
  the key if this object is used in a map

### setEntityContext(EntityContext) Method

    public void setEntityContext(EntityContext ctx)
         throws EJBException

setEntityContext method.

#### Exceptions

``EJBException``

### unsetEntityContext() Method

    public void unsetEntityContext()
         throws EJBException

unsetEntityContext method.

#### Exceptions

``EJBException``