Hey Craig,

> Hi jBoss, Simone,
> 
> Ive looked at BMPPersistanceManager and AbstractInstanceCache 
> code and 
> determined
> that a call on remove() doesnt actually remove the entity from the 
> cache!!!  

I should have fixed it, but may I ask you to try it out and tell if
everything is OK ? (It was a problem in the instance interceptor, BTW :)

Thanks,

Simon

> So when you try
> and create an entity with the same primary key later the 
> cache throws the 
> exception that
> the entity is already there. The following comment is in the 
> release(EnterpriseContext)
> method, suggesting that calling release() is the best policy 
> (even though 
> its not called
> in the current BMPPersistanceManager.removeEntity() method!!!).
> 
>                  // Here I remove the bean; call to 
> remove(id) is wrong
>                  // cause will remove also the cache lock 
> that is needed
>                  // by the passivation, that eventually will 
> remove it.
> 
> This is never going to work for the scenario I am trying. It 
> has to be gone 
> from the cache
> immediately! I added some lines to 
> BMPPersistanceManager.removeEntity() to 
> do this
> and it solved the problem,.. not sure what it will do to the 
> passivation 
> system though.
> Do we need some code to identify that a cached entity has 
> been removed(), 
> but not
> actually remove it, so the insert of a new entity with the 
> same key can 
> proceed?
> 
> cheers
> craig
> 
> 
> 
> At 14:36 11/01/01, Craig Day wrote:
> >Before I start shouting "CRIITICAL BUG" is there anything I 
> should check 
> >in relation
> >to configuration of jboss that may cause the problem:
> >
> >The following code snippet inside the stateless session bean 
> >SimpleSessionBean:
> >
> >System.out.println("Looking up referance");
> >Object ref  = jndiContext.lookup("CategoryBean");
> >System.out.println("Got reference");
> >CategoryHome home = (CategoryHome)
> >     PortableRemoteObject.narrow (ref, CategoryHome.class);
> >
> >Category cat = home.create("xxx");
> >System.out.println(cat.getCategoryID());
> >cat.remove();
> >home.create("xxx");
> >
> >produces the following error in jBoss (latest CVS)
> >
> >[Default] JBoss PRE-2.1 Started
> >[SimpleSessionBean] Got context
> >[SimpleSessionBean] Looking up referance
> >[SimpleSessionBean] Got reference
> >[CategoryBean] CategoryBean: in setEntityContext()
> >[CategoryBean] CategoryBean: in ejbCreate()
> >[CategoryBean] CategoryBean: in ejbPostCreate()
> >[SimpleSessionBean] xxx
> >[CategoryBean] CategoryBean: in ejbRemove()
> >[CategoryBean] CategoryBean: in setEntityContext()
> >[CategoryBean] CategoryBean: in ejbCreate()
> >[CategoryBean] TRANSACTION ROLLBACK EXCEPTION:null; nested 
> exception is:
> >         javax.ejb.EJBException
> >[CategoryBean] java.lang.IllegalStateException: INSERTING AN ALREADY 
> >EXISTING BEAN, ID = xxx
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractIn
> stanceCache.java:205)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPP
> ersistenceManager.java:165)
> >[CategoryBean]  at 
> >org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:441)
> >[CategoryBean]  at java.lang.reflect.Method.invoke(Native Method)
> >[CategoryBean]  at 
> >org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome
> (EntityContainer.java:639)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke
> Home(EntitySynchronizationInterceptor.java:160)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(En
> tityInstanceInterceptor.java:87)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxIntercept
> orCMT.java:135)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Tx
> InterceptorCMT.java:263)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxIntercept
> orCMT.java:86)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(Security
> Interceptor.java:125)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogIntercepto
> r.java:106)
> >[CategoryBean]  at 
> >org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:316)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke
> Home(JRMPContainerInvoker.java:404)
> >[CategoryBean]  at 
> >org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomePr
> oxy.java:198)
> >[CategoryBean]  at $Proxy4.create(Unknown Source)
> >[CategoryBean]  at 
> site.SimpleSessionBean.doit(SimpleSessionBean.java:59)
> >
> >with the following deployment descriptor:
> >
> ><ejb-jar>
> >     <enterprise-beans>
> >         <entity>
> >                     <description>Models a Category</description>
> >                     <ejb-name>CategoryBean</ejb-name>
> >                     <home>site.CategoryHome</home>
> >                     <remote>site.Category</remote>
> >                     <ejb-class>site.CategoryBean</ejb-class>
> >                     <persistence-type>Bean</persistence-type>
> >                     
> <prim-key-class>java.lang.String</prim-key-class>
> >                     <transaction-type>Container</transaction-type>
> >                     <reentrant>true</reentrant>
> >             </entity>
> >
> >         <session>
> >                 <description>A Simple Session Bean</description>
> >                 <ejb-name>SimpleSessionBean</ejb-name>
> >                 <home>site.SimpleSessionHome</home>
> >                 <remote>site.SimpleSession</remote>
> >                 <ejb-class>site.SimpleSessionBean</ejb-class>
> >                 <session-type>Stateless</session-type>
> >                 <transaction-type>Container</transaction-type>
> >         </session>
> >
> >         <container-transaction>
> >             <method>
> >                 <ejb-name>SimpleSessionBean</ejb-name>
> >                 <method-name>*</method-name>
> >             </method>
> >             <trans-attribute>Required</trans-attribute>
> >         </container-transaction>
> >
> >     </enterprise-beans>
> ></ejb-jar>
> >
> >
> >
> >--
> >--------------------------------------------------------------
> >To subscribe:        [EMAIL PROTECTED]
> >To unsubscribe:      [EMAIL PROTECTED]
> >List Help?:          [EMAIL PROTECTED]
> >
> 
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
> 


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to