I have a problem with remove and relation on jboss 3.2.6. (was working on 3.2.3)
I would like to know if I made a mistake or if this is a bug I need to report :
I have 2 ejbs in relation :
One 'Parent' which has 0 or 1 'zeroOrOneChild'. My problem is that a call to remove on
Parent fail with a NoSuchObjectLocalException if the relation is null (Parent has no
zeroOrOneChild).
the ZeroOrOneChild table has a field idParent matching with its associate Parent
(forein key).
Here is my relation :
ejb-relationship-role
|
ejb-relationship-role-nameParent-facmp20-has-zeroOrOneChild-facmp20/ejb-relationship-role-name
| multiplicityOne/multiplicity
| relationship-role-source
|ejb-nameParent/ejb-name
| /relationship-role-source
| cmr-field
|cmr-field-namezeroOrOneChild/cmr-field-name
| /cmr-field
| /ejb-relationship-role
Parent.getZeroOrOneChild() can have a null value (I guess there is nothing special to
set into the descriptor)
and the log and stacktrace when removing Parent with idParent=65558 and which has no
ZeroOrOneChild :
2004-11-03 17:54:27,620 DEBUG [myapplicationlog] remove Parent
2004-11-03 17:54:27,620 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ZeroOrOneChild] Executing SQL:
SELECT CdCleRIB, CdCodeCdR, CdCodeTiers, CdEvent, CdFonction, CdMillesime,
CdModeReglement, CdProgramme, CdService, DtEcheanceAmortissement, DtEcheanceInteret,
DtEncaissement, FlBonification, FlFraisGestion, LbFournisseur, LbImputationCapital,
LbImputationICNE, LbImputationInteret FROM ZeroOrOneChild WHERE (IdParent=?)
2004-11-03 17:54:27,620 ERROR [org.jboss.ejb.plugins.LogInterceptor]
TransactionRolledbackLocalException in method: null, causedBy:
javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=[.65558.]
at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:158)
at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:341)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:484)
at org.jboss.ejb.Container.invoke(Container.java:709)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.invokeRemoveRelation(JDBCCMRFieldBridge.java:1211)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:1026)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:1012)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:996)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:890)
at
org.jboss.ejb.plugins.cmp.jdbc.CascadeDeleteStrategy$NoneCascadeDeleteStrategy.removedIds(CascadeDeleteStrategy.java:52)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.removeFromRelations(JDBCCMRFieldBridge.java:393)
at
org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.removeFromRelations(JDBCEntityBridge.java:308)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.execute(JDBCRemoveEntityCommand.java:91)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.removeEntity(JDBCStoreManager.java:682)
at
org.jboss.ejb.plugins.CMPPersistenceManager.removeEntity(CMPPersistenceManager.java:466)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.removeEntity(CachedConnectionInterceptor.java:457)
at org.jboss.ejb.EntityContainer.remove(EntityContainer.java:500)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:72)
at
org.jboss.cache.invalidation.triggers.EntityBeanCacheBatchInvalidatorInterceptor.invoke(EntityBeanCacheBatchInvalidatorInterceptor.java:113)
I understand that Jboss is looking for an element on 'ZeroOrOneChild' which has a
idParent matching with the parent to be removed.
But as this is a 0..1 relation it should not throw an exeption if no object is found,
should it ?