-
1. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
sergeg Jan 25, 2013 2:26 PM (in response to kkkppp)Looks like synchronization(on ejbFind/ejbRemove) works for CMP only:
was:
public class EntityContainer
...
public void remove(Invocation mi)
throws RemoteException, RemoveException
{
// synchronize entities with the datastore before the bean is removed
// this will write queued updates so datastore will be consistent before removal
Transaction tx = mi.getTransaction();
if (!getBeanMetaData().getContainerConfiguration().getSyncOnCommitOnly())
synchronizeEntitiesWithinTransaction(tx);
...
public Object find(Invocation mi) throws Exception
...
// as per the spec 9.6.4, entities must be synchronized with the datastore when an ejbFind<METHOD> is called. if (!syncOnCommitOnly) { synchronizeEntitiesWithinTransaction(tx); now:
public class CmpEntityBeanHomeFinderInterceptorFactory extends EntityBeanHomeFinderInterceptorFactory {
...
protected Object invokeFind(final InterceptorContext context, final EntityBeanComponentInstance instance) throws Exception { ...
// as per the spec 9.6.4, entities must be synchronized with the datastore when an ejbFind<METHOD> is called.
if (!store.getCmpConfig().isSyncOnCommitOnly()) {
cmpComponent.synchronizeEntitiesWithinTransaction(entityContext.getTransaction());
}
and, afaiu, there are no synchronizeEntitiesWithinTransaction for BMP's ejbFind/ejbRemove ?
-
2. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
kkkppp Jan 26, 2013 3:54 AM (in response to sergeg)So it seems that behaviour is totally different for BMP beans in Jboss4 and AS7 in part of sync before ejbRemove invocation.
Could anyone from Jboss team confirm/comment that? Also, what could I do without rewriting my EJB2 code? Is it possible to add my own container interceptor to somehow emulate old behaviour?
-
3. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
noelaa5 Mar 16, 2013 7:13 PM (in response to kkkppp)Same problem here. I cannot use ejbRemove if entities are not synchronised.
would there be any fix to this problem in future versions ?
Thanks
-
4. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
wdfink Mar 17, 2013 12:52 PM (in response to kkkppp)The behaviour of EJB2 entities is different in AS7 as the container is rewritten.
From the ejb specification I'm not 100% sure whether ejbStore must be called during remove, from my understanding it is not necessary.
The configuration is not longer possible via conf/standardjboss.xml.
In case of BMP you might patch the code which handle the entity inside the ejb3 module.
-
5. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
wdfink Mar 17, 2013 12:58 PM (in response to noelaa5)With the next version of JBoss (AS8) there is no longer a support for EJB2 entities, the module and classes will be removed.
This is according to the JavaEE7 where the support of Entities and EB2 deployments is marked as 'pruned' and optional.
So I would say there will be no fix for that in future releases.
With EJB2 applications you might stay with AS5,
or the other possible option is to use the EAP version to request bugfixes, see Red Hat support policy.
-
6. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
kkkppp Mar 17, 2013 11:22 PM (in response to wdfink)It's not about ejbStore called during ejbRemove, it's about synchronizing EJB transaction with database. Currently BMP entities are in sync only if ejbCreate was called within transaction, but not any other business method. So ejbRemove or ejbFind would work with DB in pre-transaction state which is not correct.
-
7. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
noelaa5 Mar 18, 2013 8:21 PM (in response to wdfink)Hi Wolf, Thanks for your reply.
Given that JBoss7 supports EJB2.x , it s an obvious bug on BMP entities, i don t understand why wouldn t that be fixed ?
-
8. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
wdfink Mar 19, 2013 5:57 AM (in response to noelaa5)AS7 is the community part of JBoss, bugfixes might go into the next AS release which will be AS8. But unfortunately here EJB2 entities are not longer supported according to the spec (marked as optional).
You might try EAP6.1.Alpha which is equivalent to AS7.2.0, but I suppose the bug is not fixed here.
If you are able to contribute, use the github repository to provide a fix and send a pull-request.
If you need to request a bugfix you have to switch to the supported EAP6 with a supscription to have bugfixes and security updates for a longer term, see Red Hat support policy.
-
9. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
noelaa5 Mar 27, 2013 5:57 PM (in response to wdfink)I tried to fix this issue myself but got some difficulties as it appears that the whole synchronising functionnality is not implemented for BMP entity beans.
In class EntityBeanRemoveInterceptor, method processInvocation, I added the synchronising call
entityBeanComponent.synchronizeEntitiesWithinTransaction.
Problem is that method synchronizeEntitiesWithinTransaction. is defined only in child CmpEntityBeanComponent
So having to define this method at the parent level EntityBeanComponent means moving all the synchronising code one level up which seems complicated.
Is there any other ways to synchronise entities other than implementing all the logic at the EntityBean level ?
Thanks,
-
10. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
ohmygod Mar 28, 2013 2:22 AM (in response to noelaa5)Hi kkkppp, how did you build jboss 7.1.3 version? Can you please suggest?
-
11. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
kkkppp Mar 28, 2013 3:01 AM (in response to ohmygod) -
12. Re: [Jboss 7.1.3] ejbStore not called for EJB2 entity bean
noelaa5 Mar 29, 2013 5:43 AM (in response to ohmygod)I suppose Mike s question is not a reply to my question:
Just to keep it alive:
I tried to fix this issue myself but got some difficulties as it appears that the whole synchronising functionnality is not implemented for BMP entity beans.
In class EntityBeanRemoveInterceptor, method processInvocation, I added the synchronising call
entityBeanComponent.synchronizeEntitiesWithinTransaction.
Problem is that method synchronizeEntitiesWithinTransaction. is defined only in child CmpEntityBeanComponent
So having to define this method at the parent level EntityBeanComponent means moving all the synchronising code one level up which seems complicated.
Is there any other ways to synchronise entities other than implementing all the logic at the EntityBean level ?
Thanks,