Unable to persist entity from 2 data stores

Hi,

I have UserAnnouncement entity which has attributes from both main and additional data store.

I have added additional data store attributes as per the cuba documentation.

UserAnnouncement entity has browse and edit view. Fetching attribute values from additional data store (MDS) was no

problem but when I try to edit particular UserAnnouncement entity it cannot be persisted.

The exact error that appears when I click UserAnnouncement edit view OK button is:

java.lang.IllegalStateException: No active transaction for MDS database
	at com.haulmont.cuba.core.sys.PersistenceImpl.getEntityManager(PersistenceImpl.java:163)
	at com.haulmont.cuba.core.sys.EntityFetcher.fetch(EntityFetcher.java:146)
	at com.haulmont.cuba.core.sys.EntityFetcher.fetch(EntityFetcher.java:65)
	at com.haulmont.cuba.core.app.RdbmsStore.commit(RdbmsStore.java:335)
	at com.haulmont.cuba.core.app.DataManagerBean.commit(DataManagerBean.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.haulmont.cuba.core.app.DataManagerBean$SecureDataManagerInvocationHandler.invoke(DataManagerBean.java:356)
	at com.sun.proxy.$Proxy289.commit(Unknown Source)
	at com.haulmont.cuba.core.app.DataServiceBean.commit(DataServiceBean.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
	at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:117)
	at sun.reflect.GeneratedMethodAccessor165.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy193.commit(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.haulmont.cuba.core.sys.remoting.LocalServiceInvokerImpl.invoke(LocalServiceInvokerImpl.java:94)
	at com.haulmont.cuba.web.sys.remoting.LocalServiceProxy$LocalServiceInvocationHandler.invoke(LocalServiceProxy.java:148)
	at com.sun.proxy.$Proxy26.commit(Unknown Source)
	at com.haulmont.cuba.client.sys.DataManagerClientImpl.commit(DataManagerClientImpl.java:96)
	at com.haulmont.cuba.gui.data.impl.GenericDataSupplier.commit(GenericDataSupplier.java:90)
	at com.haulmont.cuba.gui.data.impl.DsContextImpl.commit(DsContextImpl.java:166)
	at com.haulmont.cuba.gui.components.EditorWindowDelegate.commit(EditorWindowDelegate.java:281)
	at com.haulmont.cuba.web.gui.WebWindow$Editor.commitAndClose(WebWindow.java:1595)
	at com.haulmont.cuba.gui.components.AbstractEditor.commitAndClose(AbstractEditor.java:109)
	at com.haulmont.cuba.gui.components.EditorWindowDelegate$2.actionPerform(EditorWindowDelegate.java:101)
	at com.haulmont.cuba.web.gui.components.WebButton.performAction(WebButton.java:44)
	at com.haulmont.cuba.web.gui.components.WebButton.lambda$new$61446b05$1(WebButton.java:36)

I am using MS SQL Server 2012+ database and both datastores use the same database.
Can you tell me what might be the problem.

Hi Martin,

What platform version are you using?

HI,
The platform version I tram using is 6.6.5.
I also tried with 6.6.3.

Hi Martin,
This is a bug, see https://youtrack.cuba-platform.com/issue/PL-10122
We’ve just fixed it, the fix will be available in the recent 6.7 release.

Hi Konstantin,

Thanks for the update.

As far I understand in 6.7.4 platform version this bug will be fixed. Can you tell me when 6.7.4 platform version will be available for download in Cuba Platform website.

Thanks,

Martin,
The platform release 6.7.4 with the fix will be available next week.
Thank you for reporting the issue!

Hi Konstantin,

The new platform version release works as expected- the issue with update of

entities from additional datastore no longer exists.

I want to thank you and your team also on behalf of our company’s CEO Mr.Delyan Lilov.

Regards,