ID Objects

  • When you create an ID, the ID object will not be null. After you use an ID to retrieve an entity (using getEntity()), that is when you find out if the entity actually exists. Just because an ID exists, doesn't mean the entity itself exists! DO: So you must check for null before attempting to use the entity you retrieved. For example:

BatchControlId id = ... 
BatchControl batchControl = id.getEntity(); 
if (batchControl == null) { /* oh oh */ }