PopulateModel() causing ORM object to detach?

Hello Guys,

I’ve been having a strange issue recently where for some reason when running integration tests it appears an object is detaching from the orm session.

I was discussing this over on the MXUnit group: Google Groups

This morning I have been digging deeper into the code, slowly removing elements to try and trace the root cause of the problem.

What I’ve found, is that if in my handler method, I comment out PopulateModel() then I no longer get the exception, and the object saves just fine.

I’ve had a look through the CB source and can’t for the life of me spot what might be causing this.

Any suggestions?

Thanks,

Robert

Are you populating primary keys?

That is the best case for detaching objects

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Why are you reading and writing emails instead of listening to the awesome speaker? :smiley:

Hi Luis,

I’m not populating primary keys, no. Not that I’m aware of at least.

The only FORM variable I’m padding to the event is called ‘Name’, which matches a property on the entity. The ID is a generator=‘UUID’.

Thanks,

Robert

Haha are both of you lucky buggers at cfobjective?

Oooh.

O.k you’re quite right actually Luis. :slight_smile:

I just had a look through, and it seems I’m defining FORM.plan_id in another test method in a completely different set of test cases, that are being run as part of the suite.

I’d assumed the FORM structure would be cleared for each test.

Is setting the FORM the best way to add values into the request context in test cases? or is their a more appropriate way of doing it?

Thanks,

Robert

Sounds good to me

Hi Luis,

Is there a better way of populating the event context for each test rather that explicitly defining FORM.SomeVariable?

Robert

hmm either that or doing a event.getCollection() and then adding them

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano