RE: Hibernate - OSIV

2010-04-02 Thread Pointbreak
With OSIV every user will have a different hibernate-session, hence a
different hibernate object, so your example would work. But your
approach is wrong. For your example I would make a SurveyResult object
that holds a reference to your hibernate Survey object. Problem solved.
No need to play jiggle with transient properties and object identities
in hibernate.

On Thu, 01 Apr 2010 16:11 -0500, Jeffrey Schneller
jeffrey.schnel...@envisa.com wrote:
 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-nameopensessioninview/filter-name
 
 filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
 init-param
   param-namesingleSession/param-name
   param-valuefalse/param-value
 /init-param
 /filter
 
 -Original Message-
 From: James Carman [mailto:jcar...@carmanconsulting.com] 
 Sent: Thursday, April 01, 2010 4:37 PM
 To: users@wicket.apache.org
 Subject: Re: Hibernate - OSIV
 
 Why do you need different objects?
 
 On Thu, Apr 1, 2010 at 4:25 PM, Jeffrey Schneller
 jeffrey.schnel...@envisa.com wrote:
  So by using the OSIV, I am out of luck?  Any ideas?
 
 
 
  -Original Message-
  From: James Carman [mailto:jcar...@carmanconsulting.com]
  Sent: Thursday, April 01, 2010 3:59 PM
  To: users@wicket.apache.org
  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
  jeffrey.schnel...@envisa.com 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:jchappe...@4redi.com]
  Sent: Wednesday, March 31, 2010 7:01 PM
  To: users@wicket.apache.org
  Subject: RE: Hibernate - OSIV
 
  What error are you getting?
 
  -Original Message-
  From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com]
  Sent: Wednesday, March 31, 2010 4:47 PM
  To: users@wicket.apache.org
  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: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr

RE: Hibernate - OSIV

2010-04-01 Thread Jeffrey Schneller
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:jchappe...@4redi.com] 
Sent: Wednesday, March 31, 2010 7:01 PM
To: users@wicket.apache.org
Subject: RE: Hibernate - OSIV 

What error are you getting?

-Original Message-
From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com] 
Sent: Wednesday, March 31, 2010 4:47 PM
To: users@wicket.apache.org
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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Hibernate - OSIV

2010-04-01 Thread James Carman
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
jeffrey.schnel...@envisa.com 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:jchappe...@4redi.com]
 Sent: Wednesday, March 31, 2010 7:01 PM
 To: users@wicket.apache.org
 Subject: RE: Hibernate - OSIV

 What error are you getting?

 -Original Message-
 From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com]
 Sent: Wednesday, March 31, 2010 4:47 PM
 To: users@wicket.apache.org
 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Hibernate - OSIV

2010-04-01 Thread James Carman
Why do you need different objects?

On Thu, Apr 1, 2010 at 4:25 PM, Jeffrey Schneller
jeffrey.schnel...@envisa.com wrote:
 So by using the OSIV, I am out of luck?  Any ideas?



 -Original Message-
 From: James Carman [mailto:jcar...@carmanconsulting.com]
 Sent: Thursday, April 01, 2010 3:59 PM
 To: users@wicket.apache.org
 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
 jeffrey.schnel...@envisa.com 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:jchappe...@4redi.com]
 Sent: Wednesday, March 31, 2010 7:01 PM
 To: users@wicket.apache.org
 Subject: RE: Hibernate - OSIV

 What error are you getting?

 -Original Message-
 From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com]
 Sent: Wednesday, March 31, 2010 4:47 PM
 To: users@wicket.apache.org
 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Hibernate - OSIV

2010-04-01 Thread Jeffrey Schneller
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-nameopensessioninview/filter-name

filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
init-param
param-namesingleSession/param-name
param-valuefalse/param-value
/init-param
/filter

-Original Message-
From: James Carman [mailto:jcar...@carmanconsulting.com] 
Sent: Thursday, April 01, 2010 4:37 PM
To: users@wicket.apache.org
Subject: Re: Hibernate - OSIV

Why do you need different objects?

On Thu, Apr 1, 2010 at 4:25 PM, Jeffrey Schneller
jeffrey.schnel...@envisa.com wrote:
 So by using the OSIV, I am out of luck?  Any ideas?



 -Original Message-
 From: James Carman [mailto:jcar...@carmanconsulting.com]
 Sent: Thursday, April 01, 2010 3:59 PM
 To: users@wicket.apache.org
 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
 jeffrey.schnel...@envisa.com 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:jchappe...@4redi.com]
 Sent: Wednesday, March 31, 2010 7:01 PM
 To: users@wicket.apache.org
 Subject: RE: Hibernate - OSIV

 What error are you getting?

 -Original Message-
 From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com]
 Sent: Wednesday, March 31, 2010 4:47 PM
 To: users@wicket.apache.org
 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Hibernate - OSIV

2010-04-01 Thread Scott Swank
Perhaps you want to use the survey object that you retrieve via
Hibernate as a prototype, and never fill in its transient members.

http://en.wikipedia.org/wiki/Prototype_pattern

Scott

On Thu, Apr 1, 2010 at 2:11 PM, Jeffrey Schneller
jeffrey.schnel...@envisa.com wrote:
 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-nameopensessioninview/filter-name
        
 filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
        init-param
                param-namesingleSession/param-name
                param-valuefalse/param-value
        /init-param
    /filter

 -Original Message-
 From: James Carman [mailto:jcar...@carmanconsulting.com]
 Sent: Thursday, April 01, 2010 4:37 PM
 To: users@wicket.apache.org
 Subject: Re: Hibernate - OSIV

 Why do you need different objects?

 On Thu, Apr 1, 2010 at 4:25 PM, Jeffrey Schneller
 jeffrey.schnel...@envisa.com wrote:
 So by using the OSIV, I am out of luck?  Any ideas?



 -Original Message-
 From: James Carman [mailto:jcar...@carmanconsulting.com]
 Sent: Thursday, April 01, 2010 3:59 PM
 To: users@wicket.apache.org
 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
 jeffrey.schnel...@envisa.com 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:jchappe...@4redi.com]
 Sent: Wednesday, March 31, 2010 7:01 PM
 To: users@wicket.apache.org
 Subject: RE: Hibernate - OSIV

 What error are you getting?

 -Original Message-
 From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com]
 Sent: Wednesday, March 31, 2010 4:47 PM
 To: users@wicket.apache.org
 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: RE: Hibernate - OSIV

2010-04-01 Thread James Carman
So make a copy of the db object and use that as your prototype.  You can use
serialization to do a quick deep clone of the object

On Apr 1, 2010 5:12 PM, Jeffrey Schneller jeffrey.schnel...@envisa.com
wrote:

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-nameopensessioninview/filter-name

 
filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
   init-param
   param-namesingleSession/param-name
   param-valuefalse/param-value
   /init-param
   /filter


-Original Message-
From: James Carman [mailto:jcar...@carmanconsulting.com]

Sent: Thursday, April 01, 2010 4:37 PM
To: users@wicket.apache.org
Subject: Re: Hibernate - OSIV

Wh...


Re: Hibernate - OSIV

2010-03-31 Thread James Carman
Loadabledetachablemodel?

On Mar 31, 2010 5:47 PM, Jeffrey Schneller jeffrey.schnel...@envisa.com
wrote:

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.





Here is what I have [a very simplified example]:



@SpringBean

private IProductDao dao;



// the following two lines are in the constructor for the page

Product product = dao.findBySku(sku);

ListOption options = product.getOptions();// this is lazy loaded -
Yes, I know in this example I could just eager fetch it but other times I
don't need the options



// a generic dao

public abstract class GenericDaoT extends DomainObject extends
HibernateDaoSupport



// the product dao

public class ProductDao extends GenericDaoProduct implements IProductDao {



!-web app à

   display-namewicket-spring-hibernate/display-name

   context-param

   param-namecontextConfigLocation/param-name

   param-valueclasspath:resources/applicationContext.xml/param-value

   /context-param

   listener


 
listener-classorg.springframework.web.context.ContextLoaderListener/listener-class

   /listener

   filter

   filter-nameopensessioninview/filter-name


 
filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class

   /filter



   filter

   filter-namewicket-spring-hibernate/filter-name


 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class

   init-param

   param-nameapplicationFactoryClassName/param-name


 param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value

   /init-param

   init-param

   param-nameapplicationClassName/param-name

   param-valuecom.mycompany.WicketApplication/param-value

   /init-param

   /filter



   filter-mapping

   filter-nameopensessioninview/filter-name

   url-pattern/*/url-pattern

   /filter-mapping



   filter-mapping

   filter-namewicket-spring-hibernate/filter-name

   url-pattern/*/url-pattern

   /filter-mapping



!-application context [key pieces] à

   bean id=sessionFactory class=com.mycompany.hibernate.SessionFactory

   property name=hibernateProperties

   props

   prop
key=hibernate.dialectorg.hibernate.dialect.MySQL5Dialect/prop

   prop key=hibernate.show_sqltrue/prop



   !-- connection pooling --

   prop
key=hibernate.connection.driver_classcom.mysql.jdbc.Driver/prop

   prop
key=hibernate.connection.provider_classorg.hibernate.connection.C3P0ConnectionProvider/prop

   prop key=hibernate.c3p0.initialPoolSize1/prop

   prop
key=hibernate.c3p0.idleConnectionTestPeriod300/prop

   prop key=hibernate.c3p0.acquire_increment1/prop

   prop key=hibernate.c3p0.min_size5/prop

   prop key=hibernate.c3p0.max_size20/prop

   prop key=hibernate.c3p0.timeout1800/prop

   prop key=hibernate.c3p0.max_statements50/prop

   /props

   /property

   property name=packagesToScan

   list

   valuecom.mycompany.entities/value

   /list

   /property

   /bean

   bean id=txManager


 class=org.springframework.orm.hibernate3.HibernateTransactionManager

   property name=sessionFactory

   ref bean=sessionFactory /

   /property

   /bean

tx:annotation-driven transaction-manager=txManager /



   bean id=ProductDao class=com.mycompany.hibernate.dao.ProductDao
scope=singleton

   property name=sessionFactory ref=sessionFactory /

   /bean



___

Jeffrey A. Schneller



Envisa

End-to-End E-Commerce for the Multi-Channel Merchant



281 Pleasant Street

Framingham, MA  01701

P: (508) 405-1220 x115

C: (508) 954-8044

F: (508) 405-1219


RE: Hibernate - OSIV

2010-03-31 Thread Jeffrey Schneller
I don't think that is it.  I haven't even put the object into any model yet.  I 
am just calling the dao and then calling the getter.  I haven't even gotten to 
the point where models would be in use.

-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Wednesday, March 31, 2010 5:59 PM
To: users@wicket.apache.org
Subject: Re: Hibernate - OSIV

Loadabledetachablemodel?

On Mar 31, 2010 5:47 PM, Jeffrey Schneller jeffrey.schnel...@envisa.com
wrote:

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.





Here is what I have [a very simplified example]:



@SpringBean

private IProductDao dao;



// the following two lines are in the constructor for the page

Product product = dao.findBySku(sku);

ListOption options = product.getOptions();// this is lazy loaded -
Yes, I know in this example I could just eager fetch it but other times I
don't need the options



// a generic dao

public abstract class GenericDaoT extends DomainObject extends
HibernateDaoSupport



// the product dao

public class ProductDao extends GenericDaoProduct implements IProductDao {



!-web app à

   display-namewicket-spring-hibernate/display-name

   context-param

   param-namecontextConfigLocation/param-name

   param-valueclasspath:resources/applicationContext.xml/param-value

   /context-param

   listener


 
listener-classorg.springframework.web.context.ContextLoaderListener/listener-class

   /listener

   filter

   filter-nameopensessioninview/filter-name


 
filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class

   /filter



   filter

   filter-namewicket-spring-hibernate/filter-name


 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class

   init-param

   param-nameapplicationFactoryClassName/param-name


 param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value

   /init-param

   init-param

   param-nameapplicationClassName/param-name

   param-valuecom.mycompany.WicketApplication/param-value

   /init-param

   /filter



   filter-mapping

   filter-nameopensessioninview/filter-name

   url-pattern/*/url-pattern

   /filter-mapping



   filter-mapping

   filter-namewicket-spring-hibernate/filter-name

   url-pattern/*/url-pattern

   /filter-mapping



!-application context [key pieces] à

   bean id=sessionFactory class=com.mycompany.hibernate.SessionFactory

   property name=hibernateProperties

   props

   prop
key=hibernate.dialectorg.hibernate.dialect.MySQL5Dialect/prop

   prop key=hibernate.show_sqltrue/prop



   !-- connection pooling --

   prop
key=hibernate.connection.driver_classcom.mysql.jdbc.Driver/prop

   prop
key=hibernate.connection.provider_classorg.hibernate.connection.C3P0ConnectionProvider/prop

   prop key=hibernate.c3p0.initialPoolSize1/prop

   prop
key=hibernate.c3p0.idleConnectionTestPeriod300/prop

   prop key=hibernate.c3p0.acquire_increment1/prop

   prop key=hibernate.c3p0.min_size5/prop

   prop key=hibernate.c3p0.max_size20/prop

   prop key=hibernate.c3p0.timeout1800/prop

   prop key=hibernate.c3p0.max_statements50/prop

   /props

   /property

   property name=packagesToScan

   list

   valuecom.mycompany.entities/value

   /list

   /property

   /bean

   bean id=txManager


 class=org.springframework.orm.hibernate3.HibernateTransactionManager

   property name=sessionFactory

   ref bean=sessionFactory /

   /property

   /bean

tx:annotation-driven transaction-manager=txManager /



   bean id=ProductDao class=com.mycompany.hibernate.dao.ProductDao
scope=singleton

   property name=sessionFactory ref=sessionFactory /

   /bean



___

Jeffrey A. Schneller



Envisa

End-to-End E-Commerce for the Multi-Channel Merchant



281 Pleasant Street

Framingham, MA  01701

P: (508) 405-1220 x115

C: (508) 954-8044

F: (508) 405-1219

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: RE: Hibernate - OSIV

2010-03-31 Thread James Carman
Have you tried tuning up logging?  See when the session is being
opened/closed.

On Mar 31, 2010 6:06 PM, Jeffrey Schneller jeffrey.schnel...@envisa.com
wrote:

I don't think that is it.  I haven't even put the object into any model yet.
 I am just calling the dao and then calling the getter.  I haven't even
gotten to the point where models would be in use.


-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com]...
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


RE: Hibernate - OSIV

2010-03-31 Thread Josh Chappelle
What error are you getting?

-Original Message-
From: Jeffrey Schneller [mailto:jeffrey.schnel...@envisa.com] 
Sent: Wednesday, March 31, 2010 4:47 PM
To: users@wicket.apache.org
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.

 

 

Here is what I have [a very simplified example]:

 

@SpringBean

private IProductDao dao;

 

// the following two lines are in the constructor for the page

Product product = dao.findBySku(sku);

ListOption options = product.getOptions();// this is lazy loaded -
Yes, I know in this example I could just eager fetch it but other times I
don't need the options

 

// a generic dao

public abstract class GenericDaoT extends DomainObject extends
HibernateDaoSupport

 

// the product dao

public class ProductDao extends GenericDaoProduct implements IProductDao {

 

!-web app à

display-namewicket-spring-hibernate/display-name

context-param

param-namecontextConfigLocation/param-name

 
param-valueclasspath:resources/applicationContext.xml/param-value

/context-param

listener

 
listener-classorg.springframework.web.context.ContextLoaderListener/liste
ner-class

/listener

filter

filter-nameopensessioninview/filter-name

 
filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFi
lter/filter-class

/filter

 

filter

filter-namewicket-spring-hibernate/filter-name

 
filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class

init-param

param-nameapplicationFactoryClassName/param-name

 
param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-val
ue

/init-param

init-param

param-nameapplicationClassName/param-name

param-valuecom.mycompany.WicketApplication/param-value

/init-param

/filter

 

filter-mapping

filter-nameopensessioninview/filter-name

url-pattern/*/url-pattern

/filter-mapping

 

filter-mapping

filter-namewicket-spring-hibernate/filter-name

url-pattern/*/url-pattern

/filter-mapping

 

!-application context [key pieces] à

bean id=sessionFactory
class=com.mycompany.hibernate.SessionFactory

property name=hibernateProperties

props

prop
key=hibernate.dialectorg.hibernate.dialect.MySQL5Dialect/prop


prop key=hibernate.show_sqltrue/prop



!-- connection pooling --

prop
key=hibernate.connection.driver_classcom.mysql.jdbc.Driver/prop


prop
key=hibernate.connection.provider_classorg.hibernate.connection.C3P0Conne
ctionProvider/prop

prop key=hibernate.c3p0.initialPoolSize1/prop

prop
key=hibernate.c3p0.idleConnectionTestPeriod300/prop

prop key=hibernate.c3p0.acquire_increment1/prop

prop key=hibernate.c3p0.min_size5/prop

prop key=hibernate.c3p0.max_size20/prop

prop key=hibernate.c3p0.timeout1800/prop

prop key=hibernate.c3p0.max_statements50/prop

/props

/property

property name=packagesToScan

list

valuecom.mycompany.entities/value

/list

/property

/bean

bean id=txManager

 
class=org.springframework.orm.hibernate3.HibernateTransactionManager 

property name=sessionFactory

ref bean=sessionFactory /

/property

/bean

tx:annotation-driven transaction-manager=txManager /  

 

bean id=ProductDao class=com.mycompany.hibernate.dao.ProductDao
scope=singleton

property name=sessionFactory ref=sessionFactory /

/bean

 

___ 

Jeffrey A. Schneller

 

Envisa

End-to-End E-Commerce for the Multi-Channel Merchant

 

281 Pleasant Street

Framingham, MA  01701

P: (508) 405-1220 x115

C: (508) 954-8044

F: (508) 405-1219

 



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org