Uploaded image for project: 'Lucee Development'
  1. LDEV-903

Compound primary key int being typed as float - 'identifier of an instance was altered'

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: New
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.17
    • Fix Version/s: Hibernate 3.5.5.61, 5.0.1.46
    • Labels:
      None
    • Environment:

      Windows 10 / Java 1.8.0_91, MSSQL 2012, Microsoft JDBC drivers (same issue with jTDS)

      Description

      We have a simple persistent component called RosterEmbargo tied to an MSSQL 2012 view. For compatibility with some old code, it uses a compound PK - an integer field (seasonID) and a guid field (teamID).

      We can load an instance of this component but we cannot save it within a transaction without getting this error - note the change from the seasonID int (1) to 1.0.

      identifier of an instance of RosterEmbargo was altered from {seasonID=1, teamID=E6983EDD-BBEB-43D3-BEC2-C648660142C7} to {seasonID=1.0, teamID=E6983EDD-BBEB-43D3-BEC2-C648660142C7}
      

      The component:

      component persistent="true" table="Roster_Embargoes"  schema="dbo" output="false" readonly="true"
      {
      	property name="teamID" column="teamID" insert="false" update="false" type="string" ormtype="string" fieldtype="id" ;
      	property name="seasonID" column="seasonID" insert="false" update="false" type="numeric" ormtype="int" fieldtype="id" elementtype="int";
      	property name="seasonUID" column="seasonUID" insert="false" update="false" type="string" ormtype="string";
      	property name="embargoDate" column="embargoDate" insert="false" update="false" type="date" ormtype="timestamp";
      }
      

      Code to reproduce this:

      transaction isolation='read_uncommitted' {
      	embargo = EntityLoad("RosterEmbargo",{teamID:'E6983EDD-BBEB-43D3-BEC2-C648660142C7'},true);
      	EntitySave(embargo);
      }
      

      Full stack trace:

      lucee.runtime.exp.NativeException: identifier of an instance of RosterEmbargo was altered from {seasonID=1, teamID=E6983EDD-BBEB-43D3-BEC2-C648660142C7} to {seasonID=1.0, teamID=E6983EDD-BBEB-43D3-BEC2-C648660142C7}
       	at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:85)
       	at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190)
       	at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)
       	at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
       	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
       	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
       	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
       	at org.lucee.extension.orm.hibernate.HibernateORMTransaction.end(HibernateORMTransaction.java:45)
       	at lucee.runtime.orm.ORMConnection.setAutoCommit(ORMConnection.java:216)
       	at lucee.runtime.db.DatasourceManagerImpl.end(DatasourceManagerImpl.java:264)
       	at lucee.runtime.tag.Transaction.doFinally(Transaction.java:155)
       	at inleague.test_cfm$cf.call(C:\inetpub\wwwroot\inleague\demo\inleague\test.cfm:14)
       	at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:900)
       	at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:815)
       	at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:810)
       	at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:226)
       	at lucee.runtime.listener.ModernAppListener.onRequest(ModernAppListener.java:103)
       	at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2267)
       	at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2259)
       	at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2227)
       	at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:845)
       	at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:103)
       	at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62)
       	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
       	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
       	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
       	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
       	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
       	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
       	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
       	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
       	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
       	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
       	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
       	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
       	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
       	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
       	at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:780)
       	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
       	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
       	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
       	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
       	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
       	at java.lang.Thread.run(Thread.java:745)
       Caused by: org.hibernate.HibernateException: identifier of an instance of RosterEmbargo was altered from {seasonID=1, teamID=E6983EDD-BBEB-43D3-BEC2-C648660142C7} to {seasonID=1.0, teamID=E6983EDD-BBEB-43D3-BEC2-C648660142C7}
       	... 46 more
      

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              Aquitaine Samuel Knowlton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: