Error with ORMService's deleteByID()

I'm getting the following error calling deleteByID() for an entity
with a composite PK

Error Type: Object : [N/A]
Error Messages: The fromStringValue method was not found.
Tag Context:
ID: CF_STRUCTBEAN
LINE: 904
Template: E:\web\sites\cf9.local\webapps\ROOT\coldbox\coldbox-platform
\system\orm\hibernate\BaseORMService.cfc

The .getIdentifierType() returns an the class
org.hibernate.type.EmbeddedComponentType which doesn't have that
method on it so I think more has to be done to handle composite keys.

thanks,

.brett

Brett,

I see where that would be an issue. I reworked it and just did a pull
request. It should be out on GitHub later today, or if you can't wait,
you can't wait, here is the new convertIDValueToJavaType.
Keep in mind that you may have to javacast your keys yourself as it
won't do it for you.

  /**
  * Coverts an ID, list of ID's, or array of ID's values to the
proper java type
  * The method returns a coverted array of ID's
  */
  any function convertIDValueToJavaType(required entityName,
required id){
    var hibernateMD =
ormGetSessionFactory().getClassMetaData(arguments.entityName);

    if(isDefined("hibernateMD") and not
hibernateMD.getIdentifierType().isComponentType() ){
      //id conversion to array
      if( isSimpleValue(arguments.id) ){
        arguments.id =
listToArray(arguments.id);
      }

      // Convert to hibernate native types
      for (var i=1; i lte arrayLen(arguments.id);
i=i+1){
        arguments.id[i] =
hibernateMD.getIdentifierType().fromStringValue(arguments.id[i]);
      }
    }

    return arguments.id;
  }
Thanks,
Curt Gratz
Computer Know How

Thank Curt. I saw Luis already merged it in so I have the changes.

I'll test it in a bit but took a quick look over it. I'm pretty sure
that the delete query won't work with compound keys since it is doing
an IN on a simple id list in deleteById().

Also, I'm not sure how we'd execute a batch delete based on an array
of compound keys (would have to be multiple queries right?). This
might have to just be reworked to only delete a single entity. I'm
agnostic as to what to do since it is so easy just to overwrite but
it's an issue for those that don't want extend it.

thanks,

.brett

Ha, that is probably a good point...

Not sure how I would handle that one.