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

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.

The component:

Code to reproduce this:

Full stack trace:

Environment

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

Activity

Samuel W. Knowlton 
6 July 2016 at 17:26

This issue goes away if the compound key uses GUIDs for both fields rather than one guid and one int.

Samuel W. Knowlton 
30 June 2016 at 20:02
(edited)

Interestingly, if I update the persistent CFC and type seasonID as a float, this happens:

They appear to be identical.

Theoretically, because the CFC is readonly=true, Lucee could just skip trying to do anything with it on an EntitySave - but this is pretty strange!

Also, please note that we are not explicitly trying to EntitySave a RosterEmbargo (which we can't do and don't need to do since it's a view) - it is just part of an ORM session and inside a transaction where other things are being updated.

Fixed

Details

Assignee

Reporter

Priority

Labels

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 28 June 2016 at 13:11
Updated 5 February 2021 at 12:20
Resolved 7 December 2016 at 08:05