Session Closed with ORMServices

I am not sure this is the best approach but I am getting a session closed when I am trying to do some data conversions between datasources.

Is this known, or am I just doing something unexpected?

<cfset newEntry = {

title = entryRecords.title,

views = entryRecords.views,

released = entryRecords.released

} />

<cfset newEntity =‘Entry’) />

<cfset rc.ORMService.populate(target=newEntity, memento=newEntry) />

<cfset />

I have tried forceinsert=true and flush=true and not getting in results here, anyone?


Andrew Scott

The problem is that you are calling save on the ORMService which in turn is preparing a new transaction which at the end if succesfull, closes the transaction and your session is closed. What you are trying to do is more of a script that needs transactioning at a higher level, your cfloop.

So the only difference is that instead of calling the transaction safe save() on the orm service, just call entitySave(). But make sure you surround your entire cfloop with a transaction.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:

You are right that I should be doing the tx around the loop, however the actual problem wasn’t to do with the session closing. The actual problem was that I was trying to store a numeric value into an entity that required the actual entity.

So instead of creating an entity and adding it for the relationship, I was trying to store a number instead. Once I fixed that the session closed went away. This appears to be a ColdFusion issue, not reporting the correct problem.


Andrew Scott

I run into this one all the time. Other things I have seen cause this
are notnull fields not having values and or the PK is not set when
using an assigned generator.