Buggy code:
public class CmpEntityBeanJdbcRelationshipInterceptor implements Interceptor { private static final Logger log = Logger . getLogger ( CmpEntityBeanJdbcRelationshipInterceptor . class ) ; private static final CmpEntityBeanJdbcRelationshipInterceptor INSTANCE = new CmpEntityBeanJdbcRelationshipInterceptor ( ) ; public Object processInvocation ( InterceptorContext context ) throws Exception { CMRMessage relationshipMessage = context . getPrivateData ( CMRMessage . class ) ; if ( relationshipMessage == null ) { return context . proceed ( ) ; } final CmpEntityBeanComponentInstance instance = ( ( CmpEntityBeanComponentInstance ) ( context . getPrivateData ( ComponentInstance . class ) ) ) ; <START_BUG> final CmpEntityBeanContext ctx = instance . getEntityContext ( ) ; <END_BUG> JDBCCMRFieldBridge cmrField = ( ( JDBCCMRFieldBridge ) ( context . getParameters ( ) [ 0 ] ) ) ; if ( ( CMRMessage . GET_RELATED_ID ) == relationshipMessage ) { if ( CmpEntityBeanJdbcRelationshipInterceptor . log . isTraceEnabled ( ) ) { CmpEntityBeanJdbcRelationshipInterceptor . log . trace ( ( ( ( "Getting<seq2seq4repair_space>related<seq2seq4repair_space>id:<seq2seq4repair_space>field=" + ( cmrField . getFieldName ( ) ) ) + "<seq2seq4repair_space>id=" ) + ( ctx . getPrimaryKey ( ) ) ) ) ; } return cmrField . getRelatedId ( ctx ) ; } else if ( ( CMRMessage . ADD_RELATION ) == relationshipMessage ) { Object relatedId = context . getParameters ( ) [ 1 ] ; if ( CmpEntityBeanJdbcRelationshipInterceptor . log . isTraceEnabled ( ) ) { CmpEntityBeanJdbcRelationshipInterceptor . log . trace ( ( ( ( ( ( "Add<seq2seq4repair_space>relation:<seq2seq4repair_space>field=" + ( cmrField . getFieldName ( ) ) ) + "<seq2seq4repair_space>id=" ) + ( ctx . getPrimaryKey ( ) ) ) + "<seq2seq4repair_space>relatedId=" ) + relatedId ) ) ; } cmrField . addRelation ( ctx , relatedId ) ; return null ; } else if ( ( CMRMessage . REMOVE_RELATION ) == relationshipMessage ) { Object relatedId = context . getParameters ( ) [ 1 ] ; if ( CmpEntityBeanJdbcRelationshipInterceptor . log . isTraceEnabled ( ) ) { CmpEntityBeanJdbcRelationshipInterceptor . log . trace ( ( ( ( ( ( "Remove<seq2seq4repair_space>relation:<seq2seq4repair_space>field=" + ( cmrField . getFieldName ( ) ) ) + "<seq2seq4repair_space>id=" ) + ( ctx . getPrimaryKey ( ) ) ) + "<seq2seq4repair_space>relatedId=" ) + relatedId ) ) ; } cmrField . removeRelation ( ctx , relatedId ) ; return null ; } else if ( ( CMRMessage . SCHEDULE_FOR_CASCADE_DELETE ) == relationshipMessage ) { JDBCEntityBridge entity = ( ( JDBCEntityBridge ) ( cmrField . getEntity ( ) ) ) ; entity . scheduleForCascadeDelete ( ctx ) ; return null ; } else if ( ( CMRMessage . SCHEDULE_FOR_BATCH_CASCADE_DELETE ) == relationshipMessage ) { JDBCEntityBridge entity = ( ( JDBCEntityBridge ) ( cmrField . getEntity ( ) ) ) ; entity . scheduleForBatchCascadeDelete ( ctx ) ; return null ; } else { throw new javax . ejb . EJBException ( ( "Unknown<seq2seq4repair_space>cmp2.0-relationship-message=" + relationshipMessage ) ) ; } } public static InterceptorFactory FACTORY = new InterceptorFactory ( ) { public Interceptor create ( InterceptorFactoryContext context ) { } } ; }

Fix:
final CmpEntityBeanContext ctx = instance . getEjbContext ( ) ;