Buggy code:
public class EntityBeanEjbCreateMethodInterceptorFactory implements InterceptorFactory { public static final EntityBeanEjbCreateMethodInterceptorFactory INSTANCE = new EntityBeanEjbCreateMethodInterceptorFactory ( ) ; protected EntityBeanEjbCreateMethodInterceptorFactory ( ) { } @ Override public Interceptor create ( InterceptorFactoryContext context ) { final Object existing = context . getContextData ( ) . get ( PRIMARY_KEY_CONTEXT_KEY ) ; final AtomicReference < Object > primaryKeyReference = new AtomicReference < Object > ( ) ; context . getContextData ( ) . put ( PRIMARY_KEY_CONTEXT_KEY , primaryKeyReference ) ; final Method ejbCreate = ( ( Method ) ( context . getContextData ( ) . get ( EJB_CREATE_METHOD_KEY ) ) ) ; final Method ejbPostCreate = ( ( Method ) ( context . getContextData ( ) . get ( EJB_POST_CREATE_METHOD_KEY ) ) ) ; final Object [ ] params = ( ( Object [ ] ) ( context . getContextData ( ) . get ( PARAMETERS_KEY ) ) ) ; return new Interceptor ( ) { @ Override public Object processInvocation ( final InterceptorContext context ) throws Exception { if ( existing != null ) { primaryKeyReference . set ( existing ) ; return existing ; } final Component component = context . getPrivateData ( Component . class ) ; if ( ! ( component instanceof EntityBeanComponent ) ) { throw EjbMessages . MESSAGES . unexpectedComponent ( component , EntityBeanComponent . class ) ; } final EntityBeanComponent entityBeanComponent = ( ( EntityBeanComponent ) ( component ) ) ; final EntityBeanComponentInstance instance = entityBeanComponent . acquireUnAssociatedInstance ( ) ; final Object primaryKey = invokeEjbCreate ( context , ejbCreate , instance , params ) ; <START_BUG> instance . activate ( primaryKey ) ; <END_BUG> primaryKeyReference . set ( primaryKey ) ; boolean synchronizationRegistered = false ; boolean exception = false ; final boolean instanceCachedBefore = entityBeanComponent . getCache ( ) . contains ( primaryKey ) ; entityBeanComponent . getCache ( ) . create ( instance ) ; try { invokeEjbPostCreate ( context , ejbPostCreate , instance , params ) ; final TransactionSynchronizationRegistry transactionSynchronizationRegistry = entityBeanComponent . getTransactionSynchronizationRegistry ( ) ; if ( ( transactionSynchronizationRegistry . getTransactionKey ( ) ) != null ) { if ( ! instanceCachedBefore ) { transactionSynchronizationRegistry . registerInterposedSynchronization ( new Synchronization ( ) { @ Override public void beforeCompletion ( ) { } @ Override public void afterCompletion ( final int status ) { entityBeanComponent . getCache ( ) . release ( instance , ( status == ( Status . STATUS_COMMITTED ) ) ) ; } } ) ; } synchronizationRegistered = true ; } return context . proceed ( ) ; } catch ( Exception e ) { entityBeanComponent . getCache ( ) . release ( instance , false ) ; exception = true ; throw e ; } finally { if ( ( ! synchronizationRegistered ) && ( ! exception ) ) { entityBeanComponent . getCache ( ) . release ( instance , true ) ; } } } } ; } protected void invokeEjbPostCreate ( final InterceptorContext context , final Method ejbPostCreate , final EntityBeanComponentInstance instance , final Object [ ] params ) throws Exception { } protected Object invokeEjbCreate ( final InterceptorContext context , final Method ejbCreate , final EntityBeanComponentInstance instance , final Object [ ] params ) throws Exception { } }

Fix:
instance . associate ( primaryKey ) ;