Copy link to clipboard
Copied
Hoping someone can help with this issue! I've set up ORM settings as below and my model is set up as listed. However, when utilizing, I keep getting an error that ID already exists and it appears CF is using hibernate_sequence instead of the sequence I'm specifying. Furthermore, even with savemapping=true, it is not creating any hibernate xml files (supposed to be in same directory as models).
I'm using Postgresql as the DB. I've tried restarting / different settings (even different JDBC drivers), etc without success.
This code was working fine with CF10 and trying to upgrade (unsuccessfully) to CF2018.
this["ormsettings"] = {
datasource = "db_icp",
eventHandling = false,
logsql=false,
savemapping=true,
cfclocation = application.mappings["models"]
};
component name="logins" entityName="logins" persistent="true" table="logins"
{
property name="id" column="id" fieldtype="id"
generator="sequence" params="{sequence='seq_logins_id'}";
property name="userName" type="string" hint="user who attempted login";
property name="dateInserted" ormtype="timestamp" hint="datetime of the login attempt";
property name="ipAddress" type="string" hint="IP address logged in from";
}
Copy link to clipboard
Copied
Can you please share the exact error message with screenshot?
Copy link to clipboard
Copied
Unfortunately, after spending about 10 hours on it, I gave up and installed Lucee instead, where it's working. As a side note, it was impossible to download installers for anything earlier than CF 2018 to test where the change between CF10 & CF 2018 occurred.
The error message indicated the id already existed in the table ("id = 563 already exists , violates primary key constraint"), which makes sense because it was using "hibernate_sequence" instead of the sequence I specified in ORM. I even tried it with a brand new app with one model and an index.cfm file with exact same results.
Copy link to clipboard
Copied
If you need installers for CF11 or CF2016 for testing, please let me know.
Copy link to clipboard
Copied
May you could set up a test case with Posgresql and ORM and see if you get the same thing.
Copy link to clipboard
Copied
I was able to find the following in the log:
"Error","ajp-nio-8018-exec-1","08/08/18","21:40:03","","HTTP 500 Internal Server Error"
coldfusion.rest.method.dispatch.CFRestException: HTTP 500 Internal Server Error
at coldfusion.rest.method.dispatch.CFRestException.handleException(CFRestException.java:103)
at coldfusion.rest.method.dispatch.CFInvoker.dispatch(CFInvoker.java:98)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:308)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
at coldfusion.rest.servlet.CFRestServletContainer.service(CFRestServletContainer.java:141)
at coldfusion.rest.servlet.CFRestServletContainer.service(CFRestServletContainer.java:83)
at coldfusion.rest.servlet.CFRestServlet.serviceUsingUninitializedContainers(CFRestServlet.java:1349)
at coldfusion.rest.servlet.CFRestServlet.invoke(CFRestServlet.java:933)
at coldfusion.rest.servlet.RestFilter.invoke(RestFilter.java:60)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:96)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.rest.servlet.CFRestServlet.invoke(CFRestServlet.java:526)
at coldfusion.rest.servlet.CFRestServlet.service(CFRestServlet.java:517)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:311)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:46)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:426)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: coldfusion.xml.rpc.CFCInvocationException: [coldfusion.orm.hibernate.HibernateSessionException : org.hibernate.exception.ConstraintViolati
onException: could not execute statement][javax.persistence.PersistenceException : org.hibernate.exception.ConstraintViolationException: could not ex
ecute statement][org.hibernate.exception.ConstraintViolationException : could not execute statement][org.postgresql.util.PSQLException : ERROR: dupli
cate key value violates unique constraint "search_pkey"
Detail: Key (id)=(678) already exists.]
at coldfusion.xml.rpc.CFComponentSkeleton.__createCFCInvocationException(CFComponentSkeleton.java:755)
at coldfusion.xml.rpc.CFComponentSkeleton.__invoke(CFComponentSkeleton.java:661)
at serverside.tools.Articles.rest.ArticleService.getArticles(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at coldfusion.rest.method.dispatch.CFExecutionFilter.invoke(CFExecutionFilter.java:47)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:537)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.rest.method.dispatch.CFInvoker.dispatch(CFInvoker.java:90)
... 51 more
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "search_pkey"
Detail: Key (id)=(678) already exists.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2422)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2167)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:132)
at coldfusion.server.j2ee.sql.JRunPreparedStatement.executeUpdate(JRunPreparedStatement.java:96)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175)
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3013)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3513)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:589)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:463)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1435)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1421)
at coldfusion.orm.hibernate.SessionWrapper.flush(SessionWrapper.java:198)
at coldfusion.orm.hibernate.HibernateSessionManager.flushSession(HibernateSessionManager.java:207)
at coldfusion.orm.hibernate.HibernateSessionManager.flushSession(HibernateSessionManager.java:201)
at coldfusion.orm.ORMUtils.flushSession(ORMUtils.java:249)
at coldfusion.runtime.CFPage.ORMFlush(CFPage.java:12333)
at cfArticleService2ecfc499941919$funcGETARTICLES.runFunction(fileNameChanged:45)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:552)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:483)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:446)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:397)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:370)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:597)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:823)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:629)
at coldfusion.xml.rpc.CFComponentSkeleton.__invoke(CFComponentSkeleton.java:653)
... 62 more
Copy link to clipboard
Copied
Hi Warpuser, from what you describe you might have discovered a bug. File a bug report, referring to this thread for more information.