Partitioning an Entity Using an Entity Whose Primary Key Can Be Changed
Original Publication Date: 2003-Feb-27
Included in the Prior Art Database: 2003-Feb-27
Effective use of the Enterprise JavaBeans specification support for unknown primary keys can be achieved by having the primary key support returning itself as a string. The unknown primary key support enables the deployer to change the attributes of the enterprise bean that are used as its primary key. While this support makes it easy to change and use the primary key on the enterprise bean whose primary key is changing, it may also require redeployment of other enterprise beans that use this primary key as part of their primary key and those that hold onto the primary key to represent a relationship. In the case of the relationship, this redeployment would normally be required when there is a need to query the primary key, such as when we need to find all the financial transactions for a particular account. In both cases, in order to remove the requirement to redeploy, the primary key can support a method that turns all of its pieces into a single string that can be mapped into a column. Since this conversion to a single string is done by the primary key. This allows the string to be used in other primary keys. And, in the case of querying a relationship, this method can be called to obtain the string to use in the query, so the enterprise bean with the relationship does not need to be redeployed because of a new primary key.