Because the objects have transient properties on them that are set by another
process. Basically the object is pulled from the db to create a
shell/container and the transient properties are filled in at a later time and
may be different. Not a great example but, the object is a survey and the
transient properties are the answers that a user will provide. I want to get
the same survey twice but allow the transient properties to have different
values. If it is the same object, I can't do this.
The following setting seems to do the trick. The problem is that after some
amount of time, everything locks up. It appears I am out of db connections.
<filter>
<filter-name>opensessioninview</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>false</param-value>
</init-param>
</filter>
-----Original Message-----
From: James Carman [mailto:[email protected]]
Sent: Thursday, April 01, 2010 4:37 PM
To: [email protected]
Subject: Re: Hibernate - OSIV
Why do you need different objects?
On Thu, Apr 1, 2010 at 4:25 PM, Jeffrey Schneller
<[email protected]> wrote:
> So by using the OSIV, I am out of luck? Any ideas?
>
>
>
> -----Original Message-----
> From: James Carman [mailto:[email protected]]
> Sent: Thursday, April 01, 2010 3:59 PM
> To: [email protected]
> Subject: Re: Hibernate - OSIV
>
> They have to be different sessions. Hibernate's cache (the first
> level) guarantees that you get the same object for any given entity
> within the same session.
>
> On Thu, Apr 1, 2010 at 3:47 PM, Jeffrey Schneller
> <[email protected]> wrote:
>> The issue was the object was being evicted from the Hibernate session.
>> getSession().evict(object). I had forgot that the object was being
>> evicted from the session.
>>
>> If I do not evict the object from the session then lazy loading worked.
>> This is more of a Hibernate question but, how can I get unique object
>> from a hibernate query for each query and have each object be tied to
>> the session?
>>
>> example:
>> select * from Product where sku = ?
>>
>> I want to select the same sku but get two different java objects from
>> Hibernate so the objects are not the same.
>>
>> Thanks.
>>
>>
>>
>>
>> -----Original Message-----
>> From: Josh Chappelle [mailto:[email protected]]
>> Sent: Wednesday, March 31, 2010 7:01 PM
>> To: [email protected]
>> Subject: RE: Hibernate - OSIV
>>
>> What error are you getting?
>>
>> -----Original Message-----
>> From: Jeffrey Schneller [mailto:[email protected]]
>> Sent: Wednesday, March 31, 2010 4:47 PM
>> To: [email protected]
>> Subject: Hibernate - OSIV
>>
>> I think I have the OSIV filter setup correctly but I can't access any
>> lazy
>> loaded properties of my objects. I am not even between requests when
>> this
>> is happening. Does anyone have any ideas? I can't seem to figure this
>> out.
>> I have looked at OSIV in Spring and OSIV in Wicket. I can't seem to
>> find
>> any examples that will help me to determine the problem. I have
>> included
>> all the code and xml configuration that I believe is relevant. Any help
>> would be appreciated. Also a clean example of how to setup Spring +
>> Hibernate OSIV in the wiki would be a big help.
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]