views:

27

answers:

1

Hello,

I'd like to query the database and get read-only objects with session object. I need to save the objects in my server and use them through the user session. If I use a object outside of the function that calls the database, I get this error:

"DetachedInstanceError: Parent instance is not bound to a Session; lazy load operation of attribute 'items' cannot proceed"

I don't need to make any change in those objects, so I don't need to load them again.

Is there any way that I can get that?

Thanks in advance!

A: 

You must load the parent object again.

Aaron Digulla
I'd like not to do that. I just need read-only object. I'd like to get that with the session object. The problem is I'm going to use that object many times only for reading.
bribon