ORM event handling + ORM injection + multiple datasources issue

my application config:

application.cfc:

     this.datasource = "MYDSN";
     this.ormSettings.eventHandler = "model.ORMEventHandler";

model.ORMEventHandler.cfc:

     component
extends="coldbox_3_1.system.orm.hibernate.EventHandler"{}

Coldbox.cfc:
     interceptors = [
          {class = "com.common.interceptors.ORMEvent",properties={}},
          {class =
"coldbox_3_1.system.interceptors.Autowire",properties={entityInjection=true}},
     ]

my tests:

any entity that uses the default datasource specified in
application.cfc, loads/saves just fine.

any entity with an implicit datasource (different than the default
dsn) declared in the component, i get this error:

Message org.hibernate.TransientObjectException: object references an
unsaved transient instance - save the transient instance before
flushing: coldfusion.orm.PersistentTemplateProxy
Detail Root cause :org.hibernate.HibernateException:
org.hibernate.TransientObjectException: object references an unsaved
transient instance - save the transient instance before flushing:
coldfusion.orm.PersistentTemplateProxy
Extended Info
Message org.hibernate.TransientObjectException: object references an
unsaved transient instance - save the transient instance before
flushing: coldfusion.orm.PersistentTemplateProxy
Tag Context C:\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate
\BaseORMService.cfc (411)
C:\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate
\VirtualEntityService.cfc (101)
C:\inetpub\Applications\Client Tools\layouts\Layout.Main.cfm (17)
C:\inetpub\Frameworks\coldbox_3_1\system\plugins\Renderer.cfc (384)
C:\inetpub\Frameworks\coldbox_3_1\system\Coldbox.cfc (261)
C:\inetpub\Applications\Client Tools\Application.cfc (86)
C:\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate
\EventHandler.cfc (39)

i then wrap a try/catch around line 44 in baseormservice and get this
error:

Message object references an unsaved transient instance - save the
transient instance before flushing:
coldfusion.orm.PersistentTemplateProxy

array
1
struct
COLUMN 0
ID CF_STRUCTBEAN
LINE 39
RAW_TRACE at cfEventHandler2ecfc1524973411$funcPOSTLOAD.runFunction(C:
\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate\EventHandler.cfc:
39)
TEMPLATE C:\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate
\EventHandler.cfc
TYPE CFML
2
struct
COLUMN 0
ID CF_CFPAGE
LINE 412
RAW_TRACE at cfBaseORMService2ecfc1011909783$funcGET.runFunction(C:
\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate
\BaseORMService.cfc:412)
TEMPLATE C:\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate
\BaseORMService.cfc
TYPE CFML
3
struct
COLUMN 0
ID CF_SUPERSCOPE
LINE 101
RAW_TRACE at
cfVirtualEntityService2ecfc824975626$funcGET.runFunction(C:\inetpub
\Frameworks\coldbox_3_1\system\orm\hibernate\VirtualEntityService.cfc:
101)
TEMPLATE C:\inetpub\Frameworks\coldbox_3_1\system\orm\hibernate
\VirtualEntityService.cfc
TYPE CFML

i then comment out line 39 in coldbox/system/orm/hibernate/
eventhandler.cfc and it works, although now ORM entity injection no
longer works.

another test i do is to turn off event handling in application.cfc and
it does work but now entity injection no longer works.

Aaron,

I just noticed this exact same issue, did you find a solution at all?

Curt

i wrote all the same methods of an ORM entity, mimicking it, hoping
that when this is fixed, i wont have to refactor too much code. the
same goes for the service layer of the object.

all the queries are inside the object. it does not use ORM but
injection still works.