[ 
https://issues.apache.org/jira/browse/ISIS-566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13797745#comment-13797745
 ] 

Dan Haywood commented on ISIS-566:
----------------------------------

Root cause:
- when clicking edit, we load the target object (Party) and some related 
objects - including the bank account) are also loaded in (see annotated stack 
trace below).

in the frameworksynchronizer, we do the check on the version of the loaded 
object; bank account in this case.

It seems that JDO has assigned a new version to the BankAccount, even though it 
was never updated.  But the reason it seems to have done this is that both 
BankAccount and its superclass, FinancialAccount, have @Version as an 
annotation.  Both, in turn, have a column in their respective tables in the 
database.  And, they are out of sync.

This clearly isn't right; there shouldn't be a version number on the subtype 
table (or, if it were there, then it should always be in sync with that of the 
supertype table).

Removing the @Version annotation on the BankAccount, the error went away.

To prevent this mistake from occurring on other tables, I think the fix is to 
add a new MetaModelValidator to detect any cases when @Version has been added 
incorrectly to a subtype where the supertype also has an @Version annotation.


~~~


>> this is loading of the BankAccount
RootOidDefault.<init>(ObjectSpecId, String, Oid$State, Version) line: 136       
RootOidDefault.<init>(ObjectSpecId, String, Oid$State) line: 96 
OidGenerator.createPersistentOrViewModelOid(Object, RootOid) line: 106  

>> callback from JDO
FrameworkSynchronizer$1.run() line: 107 
FrameworkSynchronizer$7.call() line: 285        
FrameworkSynchronizer$7.call() line: 1  
FrameworkSynchronizer.withLogging(PersistenceCapable, Callable<T>, CalledFrom) 
line: 270        
FrameworkSynchronizer.withLogging(PersistenceCapable, Runnable, 
FrameworkSynchronizer$CalledFrom) line: 281     
FrameworkSynchronizer.postLoadProcessingFor(PersistenceCapable, 
FrameworkSynchronizer$CalledFrom) line: 69      
PersistenceQueryFindAllInstancesProcessor(PersistenceQueryProcessorAbstract<T>).loadAdapters(ObjectSpecification,
 List<?>) line: 82     
PersistenceQueryFindAllInstancesProcessor.process(PersistenceQueryFindAllInstances)
 line: 54    
PersistenceQueryFindAllInstancesProcessor.process(PersistenceQuery) line: 1     
DataNucleusObjectStore.processPersistenceQuery(PersistenceQueryProcessor<Q>, 
PersistenceQuery) line: 542        
DataNucleusObjectStore.loadInstancesAndAdapt(PersistenceQuery) line: 537        
PersistenceSession$1.execute() line: 461        
PersistenceSession$1.execute() line: 1  
IsisTransactionManager.executeWithinTransaction(TransactionalClosureWithReturn<Q>)
 line: 217    
PersistenceSession.getInstancesFromPersistenceLayer(PersistenceQuery) line: 458 
PersistenceSession.getInstances(PersistenceQuery) line: 454     
PersistenceSession.findInstances(PersistenceQuery) line: 391    
PersistenceSession.findInstances(Query<T>, QueryCardinality) line: 386  
RuntimeContextFromSession$8.allMatchingQuery(Query<T>) line: 260        
DomainObjectContainerDefault.allMatches(Query<T>) line: 400     
DomainObjectContainerDefault.allInstances(Class<T>, long...) line: 361  
DomainObjectContainerDefault.allMatches(Class<T>, Predicate<? super T>, 
long...) line: 370      
DomainObjectContainerDefault.allMatches(Class<T>, Filter<? super T>, long...) 
line: 383 
FinancialAccountContributions(AbstractContainedObject).allMatches(Class<T>, 
Filter<? super T>, long...) line: 148       

>> resolving of the contributed collection
FinancialAccountContributions.financialAccounts(Party) line: 53 
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available 
[native method]  
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available   
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available       
Method.invoke(Object, Object...) line: not available    
ActionInvocationFacetViaMethod.invoke(ObjectAdapter, ObjectAdapter[]) line: 111 
ActionInvocationFacetWrapTransaction$1.execute() line: 56       
ActionInvocationFacetWrapTransaction$1.execute() line: 1        
IsisTransactionManager.executeWithinTransaction(TransactionalClosureWithReturn<Q>)
 line: 217    
ActionInvocationFacetWrapTransaction.invoke(ObjectAdapter, ObjectAdapter[]) 
line: 53    
ObjectActionImpl.execute(ObjectAdapter, ObjectAdapter[]) line: 345      

>> rendering of the financialAccounts collection
OneToManyAssociationContributee.get(ObjectAdapter) line: 106    
EntityCollectionModel$Type$2.load(EntityCollectionModel) line: 99       
EntityCollectionModel.load() line: 299  
EntityCollectionModel.load() line: 1    
EntityCollectionModel(LoadableDetachableModel<T>).getObject() line: 121 
CollectionContentsSortableDataProvider.size() line: 65  
DataTable$1(DataViewBase<T>).internalGetItemCount() line: 142   
DataTable$1(AbstractPageableView<T>).getItemCount() line: 235   
DataTable$1(AbstractPageableView<T>).getRowCount() line: 216    
DataTable$1(AbstractPageableView<T>).getViewSize() line: 314    
DataTable$1(AbstractPageableView<T>).getItemModels() line: 99   
DataTable$1(RefreshingView<T>).onPopulate() line: 93    
DataTable$1(AbstractRepeater).onBeforeRender() line: 116        
DataTable$1(AbstractPageableView<T>).onBeforeRender() line: 115 
DataTable$1(Component).internalBeforeRender() line: 923 
DataTable$1(Component).beforeRender() line: 991 
WebMarkupContainer(MarkupContainer).onBeforeRenderChildren() line: 1681 
WebMarkupContainer(Component).onBeforeRender() line: 3844       
WebMarkupContainer(Component).internalBeforeRender() line: 923  
WebMarkupContainer(Component).beforeRender() line: 991  
IsisAjaxFallbackDataTable<T,S>(MarkupContainer).onBeforeRenderChildren() line: 
1681     
IsisAjaxFallbackDataTable<T,S>(Component).onBeforeRender() line: 3844   
IsisAjaxFallbackDataTable<T,S>(Component).internalBeforeRender() line: 923      
IsisAjaxFallbackDataTable<T,S>(Component).beforeRender() line: 991      
CollectionContentsAsAjaxTablePanel(MarkupContainer).onBeforeRenderChildren() 
line: 1681 
CollectionContentsAsAjaxTablePanel(Component).onBeforeRender() line: 3844       
CollectionContentsAsAjaxTablePanel(Component).internalBeforeRender() line: 923  
CollectionContentsAsAjaxTablePanel(Component).beforeRender() line: 991  
CollectionContentsLinksSelectorPanel(MarkupContainer).onBeforeRenderChildren() 
line: 1681       
CollectionContentsLinksSelectorPanel(Component).onBeforeRender() line: 3844     
CollectionContentsLinksSelectorPanel(Component).internalBeforeRender() line: 
923        
CollectionContentsLinksSelectorPanel(Component).beforeRender() line: 991        
WebMarkupContainer(MarkupContainer).onBeforeRenderChildren() line: 1681 
WebMarkupContainer(Component).onBeforeRender() line: 3844       
WebMarkupContainer(Component).internalBeforeRender() line: 923  
WebMarkupContainer(Component).beforeRender() line: 991  

>>> the UI for the financialAccounts collection
CollectionPanel(MarkupContainer).onBeforeRenderChildren() line: 1681    
CollectionPanel(Component).onBeforeRender() line: 3844  
CollectionPanel(Component).internalBeforeRender() line: 923     
CollectionPanel(Component).beforeRender() line: 991     

WebMarkupContainer(MarkupContainer).onBeforeRenderChildren() line: 1681 
WebMarkupContainer(Component).onBeforeRender() line: 3844       
WebMarkupContainer(Component).internalBeforeRender() line: 923  
WebMarkupContainer(Component).beforeRender() line: 991  
WebMarkupContainer(MarkupContainer).onBeforeRenderChildren() line: 1681 
WebMarkupContainer(Component).onBeforeRender() line: 3844       
WebMarkupContainer(Component).internalBeforeRender() line: 923  
WebMarkupContainer(Component).beforeRender() line: 991  
RepeatingView(MarkupContainer).onBeforeRenderChildren() line: 1681      
RepeatingView(Component).onBeforeRender() line: 3844    
RepeatingView(AbstractRepeater).onBeforeRender() line: 136      
RepeatingView(Component).internalBeforeRender() line: 923       
RepeatingView(Component).beforeRender() line: 991       
EntityCollectionsPanel(MarkupContainer).onBeforeRenderChildren() line: 1681     
EntityCollectionsPanel(Component).onBeforeRender() line: 3844   
EntityCollectionsPanel(Component).internalBeforeRender() line: 923      
EntityCollectionsPanel(Component).beforeRender() line: 991      
EntityPropertiesForm(MarkupContainer).onBeforeRenderChildren() line: 1681       
EntityPropertiesForm(Component).onBeforeRender() line: 3844     
EntityPropertiesForm(Form<T>).onBeforeRender() line: 1743       
EntityPropertiesForm(Component).internalBeforeRender() line: 923        
EntityPropertiesForm(Component).beforeRender() line: 991        
EntityPropertiesPanel(MarkupContainer).onBeforeRenderChildren() line: 1681      
EntityPropertiesPanel(Component).onBeforeRender() line: 3844    
EntityPropertiesPanel(Component).internalBeforeRender() line: 923       
EntityPropertiesPanel(Component).beforeRender() line: 991       
EntityCombinedPanel(MarkupContainer).onBeforeRenderChildren() line: 1681        
EntityCombinedPanel(Component).onBeforeRender() line: 3844      
EntityCombinedPanel(Component).internalBeforeRender() line: 923 
EntityCombinedPanel(Component).beforeRender() line: 991 
EntityLinksSelectorPanel(MarkupContainer).onBeforeRenderChildren() line: 1681   
EntityLinksSelectorPanel(Component).onBeforeRender() line: 3844 
EntityLinksSelectorPanel(Component).internalBeforeRender() line: 923    
EntityLinksSelectorPanel(Component).beforeRender() line: 991    
EntityPage(MarkupContainer).onBeforeRenderChildren() line: 1681 
EntityPage(Component).onBeforeRender() line: 3844       
EntityPage(Page).onBeforeRender() line: 798     
EntityPage.onBeforeRender() line: 86    
EntityPage(Component).internalBeforeRender() line: 923  
EntityPage(Component).beforeRender() line: 991  
EntityPage(Component).internalPrepareForRender(boolean) line: 2214      
EntityPage(Page).internalPrepareForRender(boolean) line: 241    
EntityPage(Component).render() line: 2303       
EntityPage(Page).renderPage() line: 1010        

> Concurrency conflict on related entity that has not been edited
> ---------------------------------------------------------------
>
>                 Key: ISIS-566
>                 URL: https://issues.apache.org/jira/browse/ISIS-566
>             Project: Isis
>          Issue Type: Bug
>            Reporter: Jeroen van der Wal
>            Assignee: Dan Haywood
>            Priority: Critical
>             Fix For: core-1.3.0
>
>
> This can be reproduced as follows:
> - load the Estatio demo fixture
> - Parties>allParties
> - select first party
> - unlock
> - choose edit
> ... and a concurrency exception on BankAccount (contributed collection on 
> Party via FinancialAccountContributions#financialAccounts()) is thrown:
> Another user has just changed this data
> root attempted to update org.estatio.dom.financial.BankAccount:L_0, however 
> this object has since been modified by root at Wed Oct 16 08:56:44 GMT 2013 
> [2 vs 1]



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to