Internal error (table already exists) API call

I am getting an error on a cloud code API call. The error says it’s internal but I don’t doubt I may be causing the issue.

I get the following error when running an API call named addchurch:

23:02:17.879 [master] [9A8E3060-DAEA-1C93-FF15-79432E730300] Error during task execution. The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
23:02:18.334 [master] Error: Backendless encountered an error while handling the request. An internal trouble ticket with ID 655D5D8D-220B-C89F-FF00-238C9E62D500 has been created and we will be investigating the issue.
java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists
java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists
at com.backendless.services.persistence.schema.DatabaseOperation.handleDdlException(DatabaseOperation.java:204)
at com.backendless.services.persistence.schema.DatabaseOperation.lambda$doExecute$2(DatabaseOperation.java:177)
at com.backendless.datamodel.application.dao.AppJpaTransaction.executeSync(AppJpaTransaction.java:134)
at com.backendless.datamodel.application.dao.AppJpaTransaction.executeSync(AppJpaTransaction.java:203)
at com.backendless.datamodel.application.dao.AppJpaTransaction.lambda$execute$0(AppJpaTransaction.java:46)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Suppressed: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at com.backendless.async.AsyncUtils.safeGet(AsyncUtils.java:52)
at com.backendless.async.AsyncUtils.await(AsyncUtils.java:40)
at com.backendless.services.persistence.schema.DatabaseOperation.doExecute(DatabaseOperation.java:144)
at com.backendless.services.persistence.schema.DatabaseOperation.lambda$execute$0(DatabaseOperation.java:136)
at com.backendless.util.sync.RedisSync.execute(RedisSync.java:108)
at com.backendless.util.SyncUtil.execute(SyncUtil.java:45)
at com.backendless.util.sync.ISync.execute(ISync.java:33)
at com.backendless.services.persistence.schema.DatabaseOperation.execute(DatabaseOperation.java:139)
at com.backendless.services.persistence.schema.SaveSchemaOperation.execute(SaveSchemaOperation.java:165)
at com.backendless.services.persistence.schema.SaveSchemaOperation$$EnhancerByGuice$$929618033.GUICE$TRAMPOLINE()
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)
at com.backendless.gamification.AbstractGamificationInterceptor.invoke(AbstractGamificationInterceptor.java:68)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)
at com.backendless.services.persistence.schema.SaveSchemaOperation$$EnhancerByGuice$$929618033.execute()
at com.backendless.services.persistence.common.TablesService.createTable(TablesService.java:158)
at com.backendless.services.persistence.common.TablesService.getOrMakeTable(TablesService.java:137)
at com.backendless.services.persistence.common.PersistenceOperationContext.getOrMakeEntity(PersistenceOperationContext.java:247)
at com.backendless.transaction.validator.ValidatorHelper.validateEntity(ValidatorHelper.java:102)
at com.backendless.services.persistence.internal.PersistenceService.upsert(PersistenceService.java:334)
at com.backendless.services.persistence.internal.PersistenceService$$EnhancerByGuice$$696951374.upsert()
at jdk.internal.reflect.GeneratedMethodAccessor693.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.backendless.dc.manager.DataConnectorChooser.invokeDefaultMethod(DataConnectorChooser.java:159)
at com.backendless.dc.manager.DataConnectorChooser.invoke(DataConnectorChooser.java:87)
at jdk.proxy2/jdk.proxy2.$Proxy235.upsert(Unknown Source)
at com.backendless.dc.manager.PersistenceProxy.upsert(PersistenceProxy.java:162)
at com.backendless.services.persistence.ContextServiceWrapper.upsert(ContextServiceWrapper.java:149)
at com.backendless.services.messaging.DeviceRegistrationPersistenceService.upsert(DeviceRegistrationPersistenceService.java:115)
at com.backendless.services.messaging.DeviceRegistrationPersistenceService$$EnhancerByGuice$$148872517.upsert()
at com.backendless.services.persistence.PersistenceUserValidationDecorator.upsert(PersistenceUserValidationDecorator.java:289)
at com.backendless.services.persistence.PersistenceUserValidationDecorator$$EnhancerByGuice$$152397603.upsert()
at com.backendless.services.persistence.common.PersistenceCustomLogicDecorator.lambda$upsert$18(PersistenceCustomLogicDecorator.java:300)
at com.backendless.servercode.codeModel.ModelCodeExtender.performActionWithValidationUnsafe(ModelCodeExtender.java:155)
at com.backendless.servercode.codeModel.ModelCodeExtender.performActionWithValidation(ModelCodeExtender.java:110)
at com.backendless.servercode.codeModel.ModelCodeExtender.performActionWithValidation(ModelCodeExtender.java:97)
at com.backendless.services.persistence.common.PersistenceCustomLogicDecorator.performActionWithValidation(PersistenceCustomLogicDecorator.java:527)
at com.backendless.services.persistence.common.PersistenceCustomLogicDecorator.upsert(PersistenceCustomLogicDecorator.java:301)
at com.backendless.services.persistence.common.PersistenceCustomLogicDecorator$$EnhancerByGuice$$153760719.upsert()
at com.backendless.services.persistence.common.PersistenceAnalyticsDecorator.upsert(PersistenceAnalyticsDecorator.java:253)
at com.backendless.services.persistence.common.PersistenceAnalyticsDecorator$$EnhancerByGuice$$85830509.GUICE$TRAMPOLINE()
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)
at com.backendless.inject.interceptors.GoogleAnalyticInterceptor.invoke(GoogleAnalyticInterceptor.java:29)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.backendless.inject.interceptors.AbstractApiCallInterceptor.lambda$invoke$0(AbstractApiCallInterceptor.java:52)
at com.backendless.services.RunnerService.executeApiCall(RunnerService.java:71)
at com.backendless.inject.interceptors.AbstractApiCallInterceptor.invoke(AbstractApiCallInterceptor.java:49)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.backendless.gamification.AbstractGamificationInterceptor.invoke(AbstractGamificationInterceptor.java:68)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)
at com.backendless.services.persistence.common.PersistenceAnalyticsDecorator$$EnhancerByGuice$$85830509.upsert()
at com.backendless.services.persistence.common.PersistenceAnalyticsDecorator$$EnhancerByGuice$$85830509.upsert()
at com.backendless.services.persistence.validator.TableExistenceDecorator.upsert(TableExistenceDecorator.java:316)
at com.backendless.services.persistence.validator.TableExistenceDecorator.upsert(TableExistenceDecorator.java:34)
at com.backendless.services.persistence.ContextServiceWrapper.upsert(ContextServiceWrapper.java:149)
at com.backendless.rt.data.DataRTServiceDecorator.upsert(DataRTServiceDecorator.java:117)
at com.backendless.rt.data.DataRTServiceDecorator$$EnhancerByGuice$$98111527.GUICE$TRAMPOLINE()
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)
at com.backendless.monitoring.PerformanceMonitoring.invoke(PerformanceMonitoring.java:31)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)
at com.backendless.rt.data.DataRTServiceDecorator$$EnhancerByGuice$$98111527.upsert()
at com.backendless.rt.data.DataRTServiceDecorator$$EnhancerByGuice$$98111527.upsert()
at com.backendless.services.persistence.ContextServiceWrapper.upsert(ContextServiceWrapper.java:149)
at com.backendless.services.persistence.common.DataAutomationEventsDecorator.upsert(DataAutomationEventsDecorator.java:427)
at com.backendless.services.persistence.common.DataAutomationEventsDecorator.upsert(DataAutomationEventsDecorator.java:55)
at com.backendless.services.persistence.common.PersistenceInterfaceAdapter.upsert(PersistenceInterfaceAdapter.java:89)
at controllers.data.api.Persistence.lambda$upsertEntity$26(Persistence.java:509)
at com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:75)
… 4 more
Caused by: java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1098)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1046)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1371)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1031)
at jdk.internal.reflect.GeneratedMethodAccessor319.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.mysql.cj.jdbc.ha.MultiHostConnectionProxy$JdbcInterfaceProxy.invoke(MultiHostConnectionProxy.java:107)
at com.mysql.cj.jdbc.ha.FailoverConnectionProxy$FailoverJdbcInterfaceProxy.invoke(FailoverConnectionProxy.java:98)
at jdk.proxy2/jdk.proxy2.$Proxy307.executeUpdate(Unknown Source)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:136)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107)
at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1554)
at org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:299)
at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1696)
at com.backendless.services.persistence.schema.DatabaseOperation.lambda$doExecute$1(DatabaseOperation.java:161)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at com.backendless.services.persistence.schema.DatabaseOperation.lambda$doExecute$2(DatabaseOperation.java:157)
… 7 more
at new ResponseError (C:\Users\noahc\OneDrive\Desktop\dev_HereIAm\new_project\node_modules\backendless-request\lib\index.js:42:116)
at checkStatus (C:\Users\noahc\OneDrive\Desktop\dev_HereIAm\new_project\node_modules\backendless-request\lib\index.js:253:9)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
code: undefined,
status: 500,
headers: {
server: ‘nginx’,
date: ‘Wed, 26 Oct 2022 03:02:19 GMT’,
‘content-type’: ‘text/plain; charset=UTF-8’,
‘content-length’: ‘11484’,
‘access-control-allow-origin’: ‘*’,
‘access-control-allow-methods’: ‘POST, GET, OPTIONS, PUT, DELETE, PATCH’,
‘strict-transport-security’: ‘max-age=86400’,
connection: ‘close’
},
body: ‘Backendless encountered an error while handling the request. An internal trouble ticket with ID 655D5D8D-220B-C89F-FF00-238C9E62D500 has been created and we will be investigating the issue.\n’ +
“java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists\n” +
“java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists\n” +
‘\tat com.backendless.services.persistence.schema.DatabaseOperation.handleDdlException(DatabaseOperation.java:204)\n’ +
‘\tat com.backendless.services.persistence.schema.DatabaseOperation.lambda$doExecute$2(DatabaseOperation.java:177)\n’ +
‘\tat com.backendless.datamodel.application.dao.AppJpaTransaction.executeSync(AppJpaTransaction.java:134)\n’ +
‘\tat com.backendless.datamodel.application.dao.AppJpaTransaction.executeSync(AppJpaTransaction.java:203)\n’ +
‘\tat com.backendless.datamodel.application.dao.AppJpaTransaction.lambda$execute$0(AppJpaTransaction.java:46)\n’ +
‘\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)\n’ +
‘\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n’ +
‘\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n’ +
‘\tat java.base/java.lang.Thread.run(Thread.java:833)\n’ +
“\tSuppressed: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists\n” +
‘\t\tat java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)\n’ +
‘\t\tat java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)\n’ +
‘\t\tat com.backendless.async.AsyncUtils.safeGet(AsyncUtils.java:52)\n’ +
‘\t\tat com.backendless.async.AsyncUtils.await(AsyncUtils.java:40)\n’ +
‘\t\tat com.backendless.services.persistence.schema.DatabaseOperation.doExecute(DatabaseOperation.java:144)\n’ +
‘\t\tat com.backendless.services.persistence.schema.DatabaseOperation.lambda$execute$0(DatabaseOperation.java:136)\n’ +
‘\t\tat com.backendless.util.sync.RedisSync.execute(RedisSync.java:108)\n’ +
‘\t\tat com.backendless.util.SyncUtil.execute(SyncUtil.java:45)\n’ +
‘\t\tat com.backendless.util.sync.ISync.execute(ISync.java:33)\n’ +
‘\t\tat com.backendless.services.persistence.schema.DatabaseOperation.execute(DatabaseOperation.java:139)\n’ +
‘\t\tat com.backendless.services.persistence.schema.SaveSchemaOperation.execute(SaveSchemaOperation.java:165)\n’ +
‘\t\tat com.backendless.services.persistence.schema.SaveSchemaOperation$$EnhancerByGuice$$929618033.GUICE$TRAMPOLINE()\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)\n’ +
‘\t\tat com.backendless.gamification.AbstractGamificationInterceptor.invoke(AbstractGamificationInterceptor.java:68)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)\n’ +
‘\t\tat com.backendless.services.persistence.schema.SaveSchemaOperation$$EnhancerByGuice$$929618033.execute()\n’ +
‘\t\tat com.backendless.services.persistence.common.TablesService.createTable(TablesService.java:158)\n’ +
‘\t\tat com.backendless.services.persistence.common.TablesService.getOrMakeTable(TablesService.java:137)\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceOperationContext.getOrMakeEntity(PersistenceOperationContext.java:247)\n’ +
‘\t\tat com.backendless.transaction.validator.ValidatorHelper.validateEntity(ValidatorHelper.java:102)\n’ +
‘\t\tat com.backendless.services.persistence.internal.PersistenceService.upsert(PersistenceService.java:334)\n’ +
‘\t\tat com.backendless.services.persistence.internal.PersistenceService$$EnhancerByGuice$$696951374.upsert()\n’ +
‘\t\tat jdk.internal.reflect.GeneratedMethodAccessor693.invoke(Unknown Source)\n’ +
‘\t\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n’ +
‘\t\tat java.base/java.lang.reflect.Method.invoke(Method.java:568)\n’ +
‘\t\tat com.backendless.dc.manager.DataConnectorChooser.invokeDefaultMethod(DataConnectorChooser.java:159)\n’ +
‘\t\tat com.backendless.dc.manager.DataConnectorChooser.invoke(DataConnectorChooser.java:87)\n’ +
‘\t\tat jdk.proxy2/jdk.proxy2.$Proxy235.upsert(Unknown Source)\n’ +
‘\t\tat com.backendless.dc.manager.PersistenceProxy.upsert(PersistenceProxy.java:162)\n’ +
‘\t\tat com.backendless.services.persistence.ContextServiceWrapper.upsert(ContextServiceWrapper.java:149)\n’ +
‘\t\tat com.backendless.services.messaging.DeviceRegistrationPersistenceService.upsert(DeviceRegistrationPersistenceService.java:115)\n’ +
‘\t\tat com.backendless.services.messaging.DeviceRegistrationPersistenceService$$EnhancerByGuice$$148872517.upsert()\n’ +
‘\t\tat com.backendless.services.persistence.PersistenceUserValidationDecorator.upsert(PersistenceUserValidationDecorator.java:289)\n’ +
‘\t\tat com.backendless.services.persistence.PersistenceUserValidationDecorator$$EnhancerByGuice$$152397603.upsert()\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceCustomLogicDecorator.lambda$upsert$18(PersistenceCustomLogicDecorator.java:300)\n’ +
‘\t\tat com.backendless.servercode.codeModel.ModelCodeExtender.performActionWithValidationUnsafe(ModelCodeExtender.java:155)\n’ +
‘\t\tat com.backendless.servercode.codeModel.ModelCodeExtender.performActionWithValidation(ModelCodeExtender.java:110)\n’ +
‘\t\tat com.backendless.servercode.codeModel.ModelCodeExtender.performActionWithValidation(ModelCodeExtender.java:97)\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceCustomLogicDecorator.performActionWithValidation(PersistenceCustomLogicDecorator.java:527)\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceCustomLogicDecorator.upsert(PersistenceCustomLogicDecorator.java:301)\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceCustomLogicDecorator$$EnhancerByGuice$$153760719.upsert()\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceAnalyticsDecorator.upsert(PersistenceAnalyticsDecorator.java:253)\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceAnalyticsDecorator$$EnhancerByGuice$$85830509.GUICE$TRAMPOLINE()\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)\n’ +
‘\t\tat com.backendless.inject.interceptors.GoogleAnalyticInterceptor.invoke(GoogleAnalyticInterceptor.java:29)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)\n’ +
‘\t\tat com.backendless.inject.interceptors.AbstractApiCallInterceptor.lambda$invoke$0(AbstractApiCallInterceptor.java:52)\n’ +
‘\t\tat com.backendless.services.RunnerService.executeApiCall(RunnerService.java:71)\n’ +
‘\t\tat com.backendless.inject.interceptors.AbstractApiCallInterceptor.invoke(AbstractApiCallInterceptor.java:49)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)\n’ +
‘\t\tat com.backendless.gamification.AbstractGamificationInterceptor.invoke(AbstractGamificationInterceptor.java:68)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceAnalyticsDecorator$$EnhancerByGuice$$85830509.upsert()\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceAnalyticsDecorator$$EnhancerByGuice$$85830509.upsert()\n’ +
‘\t\tat com.backendless.services.persistence.validator.TableExistenceDecorator.upsert(TableExistenceDecorator.java:316)\n’ +
‘\t\tat com.backendless.services.persistence.validator.TableExistenceDecorator.upsert(TableExistenceDecorator.java:34)\n’ +
‘\t\tat com.backendless.services.persistence.ContextServiceWrapper.upsert(ContextServiceWrapper.java:149)\n’ +
‘\t\tat com.backendless.rt.data.DataRTServiceDecorator.upsert(DataRTServiceDecorator.java:117)\n’ +
‘\t\tat com.backendless.rt.data.DataRTServiceDecorator$$EnhancerByGuice$$98111527.GUICE$TRAMPOLINE()\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)\n’ +
‘\t\tat com.backendless.monitoring.PerformanceMonitoring.invoke(PerformanceMonitoring.java:31)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)\n’ +
‘\t\tat com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)\n’ +
‘\t\tat com.backendless.rt.data.DataRTServiceDecorator$$EnhancerByGuice$$98111527.upsert()\n’ +
‘\t\tat com.backendless.rt.data.DataRTServiceDecorator$$EnhancerByGuice$$98111527.upsert()\n’ +
‘\t\tat com.backendless.services.persistence.ContextServiceWrapper.upsert(ContextServiceWrapper.java:149)\n’ +
‘\t\tat com.backendless.services.persistence.common.DataAutomationEventsDecorator.upsert(DataAutomationEventsDecorator.java:427)\n’ +
‘\t\tat com.backendless.services.persistence.common.DataAutomationEventsDecorator.upsert(DataAutomationEventsDecorator.java:55)\n’ +
‘\t\tat com.backendless.services.persistence.common.PersistenceInterfaceAdapter.upsert(PersistenceInterfaceAdapter.java:89)\n’ +
‘\t\tat controllers.data.api.Persistence.lambda$upsertEntity$26(Persistence.java:509)\n’ +
‘\t\tat com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:75)\n’ +
‘\t\t… 4 more\n’ +
“Caused by: java.sql.SQLSyntaxErrorException: Table ‘udt.Church’ already exists\n” +
‘\tat com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)\n’ +
‘\tat com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)\n’ +
‘\tat com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)\n’ +
‘\tat com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1098)\n’ +
‘\tat com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1046)\n’ +
‘\tat com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1371)\n’ +
‘\tat com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1031)\n’ +
‘\tat jdk.internal.reflect.GeneratedMethodAccessor319.invoke(Unknown Source)\n’ +
‘\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n’ +
‘\tat java.base/java.lang.reflect.Method.invoke(Method.java:568)\n’ +
‘\tat com.mysql.cj.jdbc.ha.MultiHostConnectionProxy$JdbcInterfaceProxy.invoke(MultiHostConnectionProxy.java:107)\n’ +
‘\tat com.mysql.cj.jdbc.ha.FailoverConnectionProxy$FailoverJdbcInterfaceProxy.invoke(FailoverConnectionProxy.java:98)\n’ +
‘\tat jdk.proxy2/jdk.proxy2.$Proxy307.executeUpdate(Unknown Source)\n’ +
‘\tat org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:136)\n’ +
‘\tat org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)\n’ +
‘\tat org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:107)\n’ +
‘\tat org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1554)\n’ +
‘\tat org.hibernate.query.internal.NativeQueryImpl.doExecuteUpdate(NativeQueryImpl.java:299)\n’ +
‘\tat org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1696)\n’ +
‘\tat com.backendless.services.persistence.schema.DatabaseOperation.lambda$doExecute$1(DatabaseOperation.java:161)\n’ +
‘\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1511)\n’ +
‘\tat com.backendless.services.persistence.schema.DatabaseOperation.lambda$doExecute$2(DatabaseOperation.java:157)\n’ +
‘\t… 7 more\n’
}

The API function is as follows (note that I have also originally tried returing the backendless.data.of(‘churches’).save(church, true) ):

/**
 * Adds a single church to the Database.
 * 
 * @param {String} name 
 * @param {String} img 
 * @param {String} bannerImg 
 * @param {String} givingImg 
 * @param {String} givingMsg 
 * @param {String} primaryColor 
 * @param {String} secondaryColor 
 * @param {String} givingLink 
 * @param {Number} membersCanPost 
 * @param {String} street 
 * @param {String} city 
 * @param {String} state 
 * @param {String} zip 
 * @param {Number} lat 
 * @param {Number} lng 
 * @param {String} contactEmail 
 * 
 * @returns {Church}
 */
addChurch(name, img, bannerImg, givingImg, givingMsg, primaryColor, 
    secondaryColor, givingLink, membersCanPost, street, city, state, zip,
    lat, lng, contactEmail) {
    var church = new Church();
    var church_params = {
        "name": name,
        "img": img,
        "bannerImg": bannerImg,
        "givingImg": givingImg,
        "givingMsg": givingMsg,
        "primaryColor": primaryColor,
        "secondaryColor": secondaryColor,
        "givingLink": givingLink,
        "membersCanPost": membersCanPost,
        "street": street,
        "city": city,
        "state": state,
        "zip": zip,
        "lat": lat,
        "lng": lng,
        "contactEmail": contactEmail,
    }
    church.validate_properties(church_params);
    church.assign_properties(church_params);
    console.log("\n\n" + Object.values(church) + "\n\n")
    //return Backendless.Data.of('churches').save(church, true);
    var save_church = Backendless.Data.of('churches').save(church, true)
        .then((saved_church) => {return saved_church})
        .catch((error) => {console.error(error)});

    const get_saved_church = () => {
        save_church.then((c) => {
            return c;
        })
    };

    return get_saved_church;
}

Here is the church item I am trying to save.

class Church extends Backendless.ServerCode.PersistenceItem {
constructor() {
super();

    /** @ type {Number} */
    // this. addressID = this.get_addressID(this.street, this.city, this.state, this.zip, this.lat, this.lng);

    /** @type {Number} */
    this.deleted = 0;

    /** @type {Number} */
    this.parentID = 0; // all kumulos data has this at zero, ask about its purpose

    /** @type {String} */
    this.organization = "None";

    /** @type {Number} */
    this.organizationType = 0;

    /** @type {Number} */
    this.build = 0;
};

By logging in the API call, I have pinpointed that the error occurs when the backendless.Data.of(table).save(obj) method is called. Which makes sense because the error says that the data table already exists. So its when the object is being added to the database.

Hello @Noah_Caldwell,

The error is related to the dynamic scheme. Server thinks that table doesn’r exist.
According to your code you create a Church() object and trying to save it to the churches table.

var church = new Church();
...
var save_church = Backendless.Data.of('churches').save(church, true)

Please rename your Church class. The class and table names should be the same.

Regards,
Olha

1 Like

I am still getting the same error, I have tried renaming the Table to ‘Church’ even being case sensitive, to no avail. I have also tried deleting the table and let the model create the table and I still get the same error.

I realize I was told to rename the class, but it doesn’t make practical sense to me to name a class plurally. I hope that renaming the table achieves the same result you are suggesting.

Now since I deleted the table, I cannot add it back again. It says just like the original error, that the table already exists. It seems the table exists but is not showing up in the backendless data management interface.

What is the name of the table are you trying to add? Is it Church or Churches or churches?

Church. So the classname remains the same and the table is called ‘Church’

I would like to name the table Church to match the class/ model name. I prefer this over naming the class ‘churches’ after the table ‘churches’.

So it’s not exactly what I want, but I have now changed the class/model to ‘churches’ and the API call is successfully responding. Thank you guys for working with me.

Are you good, or would you like us to make any changes at this point?

Later on after we are done with more important development tasks we may try to change the naming convention, but for now we are satisfied. Thanks so much for the help.