Migrating a postgresql database to CUBA

Hi, I migrated a postgresql database following the “Migrating a Legacy Application to CUBA Platform” tutorial (https://dzone.com/articles/migrating-a-legacy-application-to-cuba-platform?edition=271895&utm_source=Daily%20Digest&utm_medium=email&utm_campaign=dd%202017-02-18)
but I had some issues, for instance when I clicked ok to create standard screens after mapping, this message was shown:


"SQLException
ERROR: no existe la columna «id»
  Hint: Perhaps you meant to reference the column "cities.Id".
  Position: 12"

I fixed it changing the field to lowercase from “Id” to “id”, but, after running the application, when I select any option of the application menu, the browsers can’t be shown, this is the error:


com.haulmont.cuba.core.global.RemoteException:
---
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.cuba12): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: no existe la columna t1.city_state
  Hint: Perhaps you meant to reference the column "t1.City_State".
  Position: 137
Error Code: 0
Call: SELECT t1.ID AS a1, t1.Name AS a2, t1.City_State AS a3, t0.ID AS a4, t0.Name AS a5 FROM cities t1 LEFT OUTER JOIN states t0 ON (t0.ID = t1.City_State) LIMIT ? OFFSET ?
	bind => [50, 0]
Query: ReadAllQuery(referenceClass=City sql="SELECT t1.ID AS a1, t1.Name AS a2, t1.City_State AS a3, t0.ID AS a4, t0.Name AS a5 FROM cities t1 LEFT OUTER JOIN states t0 ON (t0.ID = t1.City_State) LIMIT ? OFFSET ?")
FetchGroup(){cityState => {class java.lang.Object=FetchGroup(cityState){name, id}}, name, id}
---
org.eclipse.persistence.exceptions.DatabaseException: 
Internal Exception: org.postgresql.util.PSQLException: ERROR: no existe la columna t1.city_state
  Hint: Perhaps you meant to reference the column "t1.City_State".
  Position: 137
Error Code: 0
Call: SELECT t1.ID AS a1, t1.Name AS a2, t1.City_State AS a3, t0.ID AS a4, t0.Name AS a5 FROM cities t1 LEFT OUTER JOIN states t0 ON (t0.ID = t1.City_State) LIMIT ? OFFSET ?
	bind => [50, 0]
Query: ReadAllQuery(referenceClass=City sql="SELECT t1.ID AS a1, t1.Name AS a2, t1.City_State AS a3, t0.ID AS a4, t0.Name AS a5 FROM cities t1 LEFT OUTER JOIN states t0 ON (t0.ID = t1.City_State) LIMIT ? OFFSET ?")
FetchGroup(){cityState => {class java.lang.Object=FetchGroup(cityState){name, id}}, name, id}
---
org.postgresql.util.PSQLException: ERROR: no existe la columna t1.city_state
  Hint: Perhaps you meant to reference the column "t1.City_State".
  Position: 137
	at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:127)
	at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	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.$Proxy182.loadList(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:497)
	at com.haulmont.cuba.core.sys.remoting.LocalServiceInvokerImpl.invoke(LocalServiceInvokerImpl.java:95)
	at com.haulmont.cuba.web.sys.remoting.LocalServiceProxy$LocalServiceInvocationHandler.invoke(LocalServiceProxy.java:146)
	at com.sun.proxy.$Proxy24.loadList(Unknown Source)
	at com.haulmont.cuba.client.sys.DataManagerClientImpl.loadList(DataManagerClientImpl.java:53)
	at com.haulmont.cuba.gui.data.impl.GenericDataSupplier.loadList(GenericDataSupplier.java:102)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.loadData(CollectionDatasourceImpl.java:587)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.refresh(CollectionDatasourceImpl.java:146)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.refresh(CollectionDatasourceImpl.java:104)
	at com.haulmont.cuba.gui.data.impl.GroupDatasourceImpl.setSuspended(GroupDatasourceImpl.java:191)
	at com.haulmont.cuba.gui.data.impl.DsContextImpl.resumeSuspended(DsContextImpl.java:83)
	at com.haulmont.cuba.gui.WindowManager.afterShowWindow(WindowManager.java:968)
	at com.haulmont.cuba.web.WebWindowManager.showWindow(WebWindowManager.java:398)
	at com.haulmont.cuba.gui.WindowManager.openWindow(WindowManager.java:597)
	at com.haulmont.cuba.web.WebWindowManager.openWindow(WebWindowManager.java:137)
	at com.haulmont.cuba.gui.config.MenuCommand.execute(MenuCommand.java:100)
	at com.haulmont.cuba.web.sys.MenuBuilder$1.menuSelected(MenuBuilder.java:173)

Is necessary to change all the tables fields to lowercase?

Thank you.

Regards.
Jorge Soto

WORLD

browser error

Hi,

The problem is caused by names of fields. They contain upper-case letters.

To prevent the error do the following:

  1. Open the migrated entity class in IDE.
  2. Quote the name of the corresponding column, as on the screenshot:

After that EclipseLink should work well. Possibly we will fix the problem in the platform - see the linked YouTrack issue.

Note: If the name of a table contains upper-case letters it could not be migrated by Studio. It is an issue and also should be fixed.

Thank you.

quote

Thank you so much Rostislav Iskandarov