coldbox 3.5 - Caching error with JDBC Provider

Hi folks,

Here’s a GIST for a handler function I have - https://gist.github.com/ea63fe09ccd92a502e74

When I try to set the cache key into cache (line 34) I receive the following error:

An exception occurred when committing the transaction. The root cause of this exception was: coldfusion.orm.hibernate.HibernatePersistenceManager$DistributedTransactionNotSupportedException: A transaction cannot be started on more than one datasource.

From the message above it seems like a nested transaction is trying to take place. I’m not using any transactions within this handler or the UserService.

Could this be a bug with the JDBC provider?

Thanks.

Nolan

I think the issue is with the jdbc provider as it uses a different datasource. Why it gices the error is because the cache is trying to serialize the user entity and some getter might be called that produce loading.

I would orobably not cache the entity but just the id of the user. Then inflate it back and rely on secondary cache for the orm entity

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano

Hi Luis,

Could I resolve this by having the JDBC cache provider point to the same database?

The reason (as you know) for using the JDBC cache is so that I can centralize the cache storage across instances rather than use the default in-memory cache.

Also, I want to start caching larger objects (mementos of entities) as opposed to just the PK. In your opinion do you think that using the JDBC cache would be faster than the ORM second level cache? Or not?

Thanks

Nolan

I would try the same datasource Nolan.