Re: Quick model/user/session question

2009-08-31 Thread Dane Laverty
The QuickStart I made doesn't have the lazy loading problem, so that's a
good sign. Now it's just a matter of working backwards between the two to
find where things fall apart. When I discover the source of the problem,
I'll post it here to give closure to the thread.

Dane

On Mon, Aug 31, 2009 at 10:21 AM, Dane Laverty wrote:

> Here's my output on a request. I'm no expert on reading these, but it looks
> pretty clear to me that the OSIV filter ("open.hibernate.session.in.view")
> is being hit before the Wicket filter ("wicket.careerconnect").
>
> DEBUG btpool0-4 - /view-jobs org.mortbay.log - Got Session ID ofm3l3dawnb1
> from cookie
> ...
> // Here's the call to OSIV filter
> DEBUG btpool0-4 - /view-jobs org.mortbay.log - call filter
> open.hibernate.session.in.view
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - Using
> SessionFactory 'sessionFactory' for OpenSessionInViewFilter
> DEBUG btpool0-4 - /view-jobs
> org.springframework.beans.factory.support.DefaultListableBeanFactory -
> Returning cached instance of singleton bean 'sessionFactory'
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - Opening
> single Hibernate Session in OpenSessionInViewFilter
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.SessionFactoryUtils - Opening Hibernate
> Session
> DEBUG btpool0-4 - /view-jobs org.hibernate.impl.SessionImpl - opened
> session at timestamp: 5127121449623552
> ...
> // Here's the call to Wicket Filter
> DEBUG btpool0-4 - /view-jobs org.mortbay.log - call filter
> wicket.careerconnect
> DEBUG btpool0-4 - /view-jobs
> org.springframework.transaction.support.TransactionSynchronizationManager -
> Retrieved value [org.springframework.orm.hibernate3.sessionhol...@835551]
> for key [org.hibernate.impl.sessionfactoryi...@11739d] bound to thread
> [btpool0-4 - /view-jobs]
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.HibernateTransactionManager - Found
> thread-bound Session [org.hibernate.impl.sessioni...@14af2c1] for
> Hibernate transaction
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.HibernateTransactionManager - Using
> transaction object
> [org.springframework.orm.hibernate3.hibernatetransactionmanager$hibernatetransactionobj...@18762b1
> ]
> ...
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.HibernateTransactionManager - Preparing
> JDBC Connection of Hibernate Session [org.hibernate.impl.sessioni...@14af2c1
> ]
> TRACE btpool0-4 - /view-jobs org.hibernate.impl.SessionImpl - setting flush
> mode to: AUTO
> DEBUG btpool0-4 - /view-jobs org.hibernate.transaction.JDBCTransaction -
> begin
> DEBUG btpool0-4 - /view-jobs org.hibernate.jdbc.ConnectionManager - opening
> JDBC connection
> DEBUG btpool0-4 - /view-jobs org.hibernate.transaction.JDBCTransaction -
> current autocommit status: true
> DEBUG btpool0-4 - /view-jobs org.hibernate.transaction.JDBCTransaction -
> disabling autocommit
> TRACE btpool0-4 - /view-jobs org.hibernate.jdbc.JDBCContext - after
> transaction begin
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.HibernateTransactionManager - Exposing
> Hibernate transaction as JDBC transaction [jdbc:hsqldb:mem:mysticpaste-test,
> UserName=SA, HSQL Database Engine Driver]
> DEBUG btpool0-4 - /view-jobs
> org.springframework.transaction.support.TransactionSynchronizationManager -
> Bound value [org.springframework.jdbc.datasource.connectionhol...@20dc10]
> for key [org.apache.commons.dbcp.basicdatasou...@1b289cd] to thread
> [btpool0-4 - /view-jobs]
> DEBUG btpool0-4 - /view-jobs
> org.springframework.transaction.support.TransactionSynchronizationManager -
> Initializing transaction synchronization
> TRACE btpool0-4 - /view-jobs
> org.springframework.transaction.interceptor.TransactionInterceptor - Getting
> transaction for [edu.chemeketa.careerconnect.persistence.EntityDao.get]
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.SessionFactoryUtils - Opening Hibernate
> Session
> DEBUG btpool0-4 - /view-jobs org.hibernate.impl.SessionImpl - opened
> session at timestamp: 5127121449623553
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.SessionFactoryUtils - Registering Spring
> transaction synchronization for new Hibernate Session
> DEBUG btpool0-4 - /view-jobs
> org.springframework.transaction.support.TransactionSynchronizationManager -
> Bound value [org.springframework.orm.hibernate3.sessionhol...@14fceb7] for
> key [org.hibernate.impl.sessionfactoryi...@1be6544] to thread [btpool0-4 -
> /view-jobs]
> DEBUG btpool0-4 - /view-jobs
> org.springframework.transaction.support.TransactionSynchronizationManager -
> Retrieved value [org.springframework.orm.hibernate3.sessionhol...@14fceb7]
> for key [org.hibernate.impl.sessionfactoryi...@1be6544] bound to thread
> [btpool0-4 - /view-jobs]
> DEBUG btpool0-4 - /view-jobs
> org.springframework.orm.hibernate3.Hibern

Re: Quick model/user/session question

2009-08-31 Thread Dane Laverty
Here's my output on a request. I'm no expert on reading these, but it looks
pretty clear to me that the OSIV filter ("open.hibernate.session.in.view")
is being hit before the Wicket filter ("wicket.careerconnect").

DEBUG btpool0-4 - /view-jobs org.mortbay.log - Got Session ID ofm3l3dawnb1
from cookie
...
// Here's the call to OSIV filter
DEBUG btpool0-4 - /view-jobs org.mortbay.log - call filter
open.hibernate.session.in.view
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - Using
SessionFactory 'sessionFactory' for OpenSessionInViewFilter
DEBUG btpool0-4 - /view-jobs
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Returning cached instance of singleton bean 'sessionFactory'
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - Opening
single Hibernate Session in OpenSessionInViewFilter
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.SessionFactoryUtils - Opening Hibernate
Session
DEBUG btpool0-4 - /view-jobs org.hibernate.impl.SessionImpl - opened session
at timestamp: 5127121449623552
...
// Here's the call to Wicket Filter
DEBUG btpool0-4 - /view-jobs org.mortbay.log - call filter
wicket.careerconnect
DEBUG btpool0-4 - /view-jobs
org.springframework.transaction.support.TransactionSynchronizationManager -
Retrieved value [org.springframework.orm.hibernate3.sessionhol...@835551]
for key [org.hibernate.impl.sessionfactoryi...@11739d] bound to thread
[btpool0-4 - /view-jobs]
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.HibernateTransactionManager - Found
thread-bound Session [org.hibernate.impl.sessioni...@14af2c1] for Hibernate
transaction
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.HibernateTransactionManager - Using
transaction object
[org.springframework.orm.hibernate3.hibernatetransactionmanager$hibernatetransactionobj...@18762b1
]
...
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.HibernateTransactionManager - Preparing
JDBC Connection of Hibernate Session [org.hibernate.impl.sessioni...@14af2c1
]
TRACE btpool0-4 - /view-jobs org.hibernate.impl.SessionImpl - setting flush
mode to: AUTO
DEBUG btpool0-4 - /view-jobs org.hibernate.transaction.JDBCTransaction -
begin
DEBUG btpool0-4 - /view-jobs org.hibernate.jdbc.ConnectionManager - opening
JDBC connection
DEBUG btpool0-4 - /view-jobs org.hibernate.transaction.JDBCTransaction -
current autocommit status: true
DEBUG btpool0-4 - /view-jobs org.hibernate.transaction.JDBCTransaction -
disabling autocommit
TRACE btpool0-4 - /view-jobs org.hibernate.jdbc.JDBCContext - after
transaction begin
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.HibernateTransactionManager - Exposing
Hibernate transaction as JDBC transaction [jdbc:hsqldb:mem:mysticpaste-test,
UserName=SA, HSQL Database Engine Driver]
DEBUG btpool0-4 - /view-jobs
org.springframework.transaction.support.TransactionSynchronizationManager -
Bound value [org.springframework.jdbc.datasource.connectionhol...@20dc10]
for key [org.apache.commons.dbcp.basicdatasou...@1b289cd] to thread
[btpool0-4 - /view-jobs]
DEBUG btpool0-4 - /view-jobs
org.springframework.transaction.support.TransactionSynchronizationManager -
Initializing transaction synchronization
TRACE btpool0-4 - /view-jobs
org.springframework.transaction.interceptor.TransactionInterceptor - Getting
transaction for [edu.chemeketa.careerconnect.persistence.EntityDao.get]
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.SessionFactoryUtils - Opening Hibernate
Session
DEBUG btpool0-4 - /view-jobs org.hibernate.impl.SessionImpl - opened session
at timestamp: 5127121449623553
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.SessionFactoryUtils - Registering Spring
transaction synchronization for new Hibernate Session
DEBUG btpool0-4 - /view-jobs
org.springframework.transaction.support.TransactionSynchronizationManager -
Bound value [org.springframework.orm.hibernate3.sessionhol...@14fceb7] for
key [org.hibernate.impl.sessionfactoryi...@1be6544] to thread [btpool0-4 -
/view-jobs]
DEBUG btpool0-4 - /view-jobs
org.springframework.transaction.support.TransactionSynchronizationManager -
Retrieved value [org.springframework.orm.hibernate3.sessionhol...@14fceb7]
for key [org.hibernate.impl.sessionfactoryi...@1be6544] bound to thread
[btpool0-4 - /view-jobs]
DEBUG btpool0-4 - /view-jobs
org.springframework.orm.hibernate3.HibernateTemplate - Found thread-bound
Session for HibernateTemplate
TRACE btpool0-4 - /view-jobs
org.hibernate.event.def.DefaultLoadEventListener - loading entity:
[edu.chemeketa.careerconnect.model.EmployerInfo#250]
TRACE btpool0-4 - /view-jobs
org.hibernate.event.def.DefaultLoadEventListener - attempting to resolve:
[edu.chemeketa.careerconnect.model.EmployerInfo#250]
TRACE btpool0-4 - /view-jobs
org.hibernate.event.def.DefaultLoadEventListener - object not resolved in
any cache: [edu.chemeketa.careerconnect.model.E

Re: Quick model/user/session question

2009-08-31 Thread James Carman
You need the output from Spring classes during a request, not during
application startup.

On Mon, Aug 31, 2009 at 12:39 PM, Dane Laverty wrote:

> Here's the output on startup. The OSIV is being loaded before the
> WicketFilter, and when I set breakpoints I can see that the
> OpenSessionInViewFilter is being hit first on each request. I'm turning the
> project into a QuickStart and will attach it to a JIRA issue.
>
> DEBUG main org.mortbay.log - loaded class
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter from
> sun.misc.launcher$appclassloa...@1a7bf11
> DEBUG main org.mortbay.log - Holding class
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> DEBUG main
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter -
> Initializing filter 'open.hibernate.session.in.view'
> DEBUG main
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - Filter
> 'open.hibernate.session.in.view' configured successfully
> DEBUG main org.mortbay.log - started open.hibernate.session.in.view
> DEBUG main org.mortbay.log - loaded class
> org.apache.wicket.protocol.http.WicketFilter from
> sun.misc.launcher$appclassloa...@1a7bf11
> DEBUG main org.mortbay.log - Holding class
> org.apache.wicket.protocol.http.WicketFilter
> DEBUG main org.mortbay.log - loaded class
> org.apache.wicket.spring.SpringWebApplicationFactory from
> sun.misc.launcher$appclassloa...@1a7bf11
> DEBUG main
> org.springframework.beans.factory.support.DefaultListableBeanFactory -
> Returning cached instance of singleton bean 'wicketApplication'
>
>
> Dane
>
>
> On Mon, Aug 31, 2009 at 9:14 AM, James Carman
> wrote:
>
> > Or, you can turn on spring logging to see it opening the session.
> >
> > On Mon, Aug 31, 2009 at 10:56 AM, Igor Vaynberg  > >wrote:
> >
> > > doesnt look like your osiv is working. you can create a wicket
> > > quickstart project and attach it to a jira issue if you want someone
> > > to take a look at it. other then that you can use the debugger to see
> > > if osiv is actually being hit *before* the wicket filter.
> > >
> > > -igor
> > >
> > > On Mon, Aug 31, 2009 at 7:50 AM, Dane Laverty
> > > wrote:
> > > > Thanks James and Igor for looking it over. Switching the order of the
> > > filter
> > > > definitions didn't make a difference. If it helps, here's what I'm
> > doing:
> > > >
> > > > 1 - This is the UserInfo class. As far as this test case is
> concerned,
> > it
> > > > has an ID and a Set to check lazy loading. I've commented out
> > the
> > > > FetchType.EAGER to test the OSIV. When it is uncommented, the
> UserPage
> > > (#2,
> > > > below) renders correctly, otherwise I get a lazy load exception.
> > > >
> > > > @Entity
> > > > @Table(name = "zjp_user_accounts")
> > > > public class UserInfo extends PersonInfo {
> > > >@Id
> > > >Long id;
> > > >
> > > >@OneToMany(mappedBy="employerInfo" /*, fetch=FetchType.EAGER*/)
> > > >Set postedJobs;
> > > >...
> > > > }
> > > >
> > > >
> > > > 2 - UserPage is the page I'm using to test lazy loading.
> > > >
> > > > public class UserPage extends WebPage {
> > > >@SpringBean(name = "personInfoDao")
> > > >private PersonInfoDao personInfoDao;
> > > >
> > > >public UserPage() {
> > > >
> > > >EntityModel personInfoModel = new
> > > > EntityModel(UserInfo.class, new Long(1));
> > > >
> > > >EmployerInfo personInfo =
> > > (EmployerInfo)personInfoModel.getObject();
> > > >Set jobs = personInfo.getPostedJobs();
> > > >Iterator itr = jobs.iterator();
> > > >while (itr.hasNext()) {
> > > >System.out.println(itr.next());
> > > >}
> > > >}
> > > > }
> > > >
> > > >
> > > > 3 - And this is the EntityModel, based on the Smart EntityModel
> article
> > -
> > > > http://wicketinaction.com/2008/09/building-a-smart-entitymodel/
> > > >
> > > > public class EntityModel> extends
> > > > AbstractEntityModel {
> > > >
> > > >@SpringBean(name = "entityDao")
> > > >private EntityDao dao;
> > > >
> > > >public EntityModel(Class clazz, Serializable id) {
> > > >super(clazz, id);
> > > >// This makes the class Spring-aware, so we can inject the
> DAOs,
> > > as
> > > > above
> > > >InjectorHolder.getInjector().inject(this);
> > > >}
> > > >
> > > >@Override
> > > >protected T load(Class clazz, Serializable id) {
> > > >return (T)dao.get(clazz, (Long)id);
> > > >};
> > > > }
> > > >
> > > >
> > > > I'd be happy to supply more code (xml files, etc.) if it would be
> > useful.
> > > I
> > > > feel that this is about as simple a use case as I can create for the
> > > issue.
> > > > Thanks again for all your help!
> > > >
> > > > Dane
> > > >
> > > >
> > > >
> > > > On Sat, Aug 29, 2009 at 7:41 AM, James Carman <
> > > ja...@carmanconsulting.com>wrote:
> > > >
> > > >> Aren't they chained based on the order of the filter mapping
> > > definitions,
> > > >> not the order of the filter definitions?
> > 

Re: Quick model/user/session question

2009-08-31 Thread Dane Laverty
Here's the output on startup. The OSIV is being loaded before the
WicketFilter, and when I set breakpoints I can see that the
OpenSessionInViewFilter is being hit first on each request. I'm turning the
project into a QuickStart and will attach it to a JIRA issue.

DEBUG main org.mortbay.log - loaded class
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter from
sun.misc.launcher$appclassloa...@1a7bf11
DEBUG main org.mortbay.log - Holding class
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
DEBUG main
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter -
Initializing filter 'open.hibernate.session.in.view'
DEBUG main
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - Filter
'open.hibernate.session.in.view' configured successfully
DEBUG main org.mortbay.log - started open.hibernate.session.in.view
DEBUG main org.mortbay.log - loaded class
org.apache.wicket.protocol.http.WicketFilter from
sun.misc.launcher$appclassloa...@1a7bf11
DEBUG main org.mortbay.log - Holding class
org.apache.wicket.protocol.http.WicketFilter
DEBUG main org.mortbay.log - loaded class
org.apache.wicket.spring.SpringWebApplicationFactory from
sun.misc.launcher$appclassloa...@1a7bf11
DEBUG main
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Returning cached instance of singleton bean 'wicketApplication'


Dane


On Mon, Aug 31, 2009 at 9:14 AM, James Carman
wrote:

> Or, you can turn on spring logging to see it opening the session.
>
> On Mon, Aug 31, 2009 at 10:56 AM, Igor Vaynberg  >wrote:
>
> > doesnt look like your osiv is working. you can create a wicket
> > quickstart project and attach it to a jira issue if you want someone
> > to take a look at it. other then that you can use the debugger to see
> > if osiv is actually being hit *before* the wicket filter.
> >
> > -igor
> >
> > On Mon, Aug 31, 2009 at 7:50 AM, Dane Laverty
> > wrote:
> > > Thanks James and Igor for looking it over. Switching the order of the
> > filter
> > > definitions didn't make a difference. If it helps, here's what I'm
> doing:
> > >
> > > 1 - This is the UserInfo class. As far as this test case is concerned,
> it
> > > has an ID and a Set to check lazy loading. I've commented out
> the
> > > FetchType.EAGER to test the OSIV. When it is uncommented, the UserPage
> > (#2,
> > > below) renders correctly, otherwise I get a lazy load exception.
> > >
> > > @Entity
> > > @Table(name = "zjp_user_accounts")
> > > public class UserInfo extends PersonInfo {
> > >@Id
> > >Long id;
> > >
> > >@OneToMany(mappedBy="employerInfo" /*, fetch=FetchType.EAGER*/)
> > >Set postedJobs;
> > >...
> > > }
> > >
> > >
> > > 2 - UserPage is the page I'm using to test lazy loading.
> > >
> > > public class UserPage extends WebPage {
> > >@SpringBean(name = "personInfoDao")
> > >private PersonInfoDao personInfoDao;
> > >
> > >public UserPage() {
> > >
> > >EntityModel personInfoModel = new
> > > EntityModel(UserInfo.class, new Long(1));
> > >
> > >EmployerInfo personInfo =
> > (EmployerInfo)personInfoModel.getObject();
> > >Set jobs = personInfo.getPostedJobs();
> > >Iterator itr = jobs.iterator();
> > >while (itr.hasNext()) {
> > >System.out.println(itr.next());
> > >}
> > >}
> > > }
> > >
> > >
> > > 3 - And this is the EntityModel, based on the Smart EntityModel article
> -
> > > http://wicketinaction.com/2008/09/building-a-smart-entitymodel/
> > >
> > > public class EntityModel> extends
> > > AbstractEntityModel {
> > >
> > >@SpringBean(name = "entityDao")
> > >private EntityDao dao;
> > >
> > >public EntityModel(Class clazz, Serializable id) {
> > >super(clazz, id);
> > >// This makes the class Spring-aware, so we can inject the DAOs,
> > as
> > > above
> > >InjectorHolder.getInjector().inject(this);
> > >}
> > >
> > >@Override
> > >protected T load(Class clazz, Serializable id) {
> > >return (T)dao.get(clazz, (Long)id);
> > >};
> > > }
> > >
> > >
> > > I'd be happy to supply more code (xml files, etc.) if it would be
> useful.
> > I
> > > feel that this is about as simple a use case as I can create for the
> > issue.
> > > Thanks again for all your help!
> > >
> > > Dane
> > >
> > >
> > >
> > > On Sat, Aug 29, 2009 at 7:41 AM, James Carman <
> > ja...@carmanconsulting.com>wrote:
> > >
> > >> Aren't they chained based on the order of the filter mapping
> > definitions,
> > >> not the order of the filter definitions?
> > >>
> > >> On Aug 29, 2009 12:40 AM, "Igor Vaynberg" 
> > wrote:
> > >>
> > >> filters are executed in the order they are defined, so put the osiv
> > >> filter declaration before wicket.
> > >>
> > >> -igor
> > >>
> > >> On Thu, Aug 27, 2009 at 8:08 AM, Dane Laverty
> > >> wrote:
> > >> > Thanks for the sugges...
> > >>
> > >
> >
> > -
> > To unsubscribe, 

Re: Quick model/user/session question

2009-08-31 Thread James Carman
Or, you can turn on spring logging to see it opening the session.

On Mon, Aug 31, 2009 at 10:56 AM, Igor Vaynberg wrote:

> doesnt look like your osiv is working. you can create a wicket
> quickstart project and attach it to a jira issue if you want someone
> to take a look at it. other then that you can use the debugger to see
> if osiv is actually being hit *before* the wicket filter.
>
> -igor
>
> On Mon, Aug 31, 2009 at 7:50 AM, Dane Laverty
> wrote:
> > Thanks James and Igor for looking it over. Switching the order of the
> filter
> > definitions didn't make a difference. If it helps, here's what I'm doing:
> >
> > 1 - This is the UserInfo class. As far as this test case is concerned, it
> > has an ID and a Set to check lazy loading. I've commented out the
> > FetchType.EAGER to test the OSIV. When it is uncommented, the UserPage
> (#2,
> > below) renders correctly, otherwise I get a lazy load exception.
> >
> > @Entity
> > @Table(name = "zjp_user_accounts")
> > public class UserInfo extends PersonInfo {
> >@Id
> >Long id;
> >
> >@OneToMany(mappedBy="employerInfo" /*, fetch=FetchType.EAGER*/)
> >Set postedJobs;
> >...
> > }
> >
> >
> > 2 - UserPage is the page I'm using to test lazy loading.
> >
> > public class UserPage extends WebPage {
> >@SpringBean(name = "personInfoDao")
> >private PersonInfoDao personInfoDao;
> >
> >public UserPage() {
> >
> >EntityModel personInfoModel = new
> > EntityModel(UserInfo.class, new Long(1));
> >
> >EmployerInfo personInfo =
> (EmployerInfo)personInfoModel.getObject();
> >Set jobs = personInfo.getPostedJobs();
> >Iterator itr = jobs.iterator();
> >while (itr.hasNext()) {
> >System.out.println(itr.next());
> >}
> >}
> > }
> >
> >
> > 3 - And this is the EntityModel, based on the Smart EntityModel article -
> > http://wicketinaction.com/2008/09/building-a-smart-entitymodel/
> >
> > public class EntityModel> extends
> > AbstractEntityModel {
> >
> >@SpringBean(name = "entityDao")
> >private EntityDao dao;
> >
> >public EntityModel(Class clazz, Serializable id) {
> >super(clazz, id);
> >// This makes the class Spring-aware, so we can inject the DAOs,
> as
> > above
> >InjectorHolder.getInjector().inject(this);
> >}
> >
> >@Override
> >protected T load(Class clazz, Serializable id) {
> >return (T)dao.get(clazz, (Long)id);
> >};
> > }
> >
> >
> > I'd be happy to supply more code (xml files, etc.) if it would be useful.
> I
> > feel that this is about as simple a use case as I can create for the
> issue.
> > Thanks again for all your help!
> >
> > Dane
> >
> >
> >
> > On Sat, Aug 29, 2009 at 7:41 AM, James Carman <
> ja...@carmanconsulting.com>wrote:
> >
> >> Aren't they chained based on the order of the filter mapping
> definitions,
> >> not the order of the filter definitions?
> >>
> >> On Aug 29, 2009 12:40 AM, "Igor Vaynberg" 
> wrote:
> >>
> >> filters are executed in the order they are defined, so put the osiv
> >> filter declaration before wicket.
> >>
> >> -igor
> >>
> >> On Thu, Aug 27, 2009 at 8:08 AM, Dane Laverty
> >> wrote:
> >> > Thanks for the sugges...
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Quick model/user/session question

2009-08-31 Thread Igor Vaynberg
doesnt look like your osiv is working. you can create a wicket
quickstart project and attach it to a jira issue if you want someone
to take a look at it. other then that you can use the debugger to see
if osiv is actually being hit *before* the wicket filter.

-igor

On Mon, Aug 31, 2009 at 7:50 AM, Dane Laverty wrote:
> Thanks James and Igor for looking it over. Switching the order of the filter
> definitions didn't make a difference. If it helps, here's what I'm doing:
>
> 1 - This is the UserInfo class. As far as this test case is concerned, it
> has an ID and a Set to check lazy loading. I've commented out the
> FetchType.EAGER to test the OSIV. When it is uncommented, the UserPage (#2,
> below) renders correctly, otherwise I get a lazy load exception.
>
> @Entity
> @Table(name = "zjp_user_accounts")
> public class UserInfo extends PersonInfo {
>   �...@id
>    Long id;
>
>   �...@onetomany(mappedBy="employerInfo" /*, fetch=FetchType.EAGER*/)
>    Set postedJobs;
>    ...
> }
>
>
> 2 - UserPage is the page I'm using to test lazy loading.
>
> public class UserPage extends WebPage {
>   �...@springbean(name = "personInfoDao")
>    private PersonInfoDao personInfoDao;
>
>    public UserPage() {
>
>        EntityModel personInfoModel = new
> EntityModel(UserInfo.class, new Long(1));
>
>        EmployerInfo personInfo = (EmployerInfo)personInfoModel.getObject();
>        Set jobs = personInfo.getPostedJobs();
>        Iterator itr = jobs.iterator();
>        while (itr.hasNext()) {
>            System.out.println(itr.next());
>        }
>    }
> }
>
>
> 3 - And this is the EntityModel, based on the Smart EntityModel article -
> http://wicketinaction.com/2008/09/building-a-smart-entitymodel/
>
> public class EntityModel> extends
> AbstractEntityModel {
>
>   �...@springbean(name = "entityDao")
>    private EntityDao dao;
>
>    public EntityModel(Class clazz, Serializable id) {
>        super(clazz, id);
>        // This makes the class Spring-aware, so we can inject the DAOs, as
> above
>        InjectorHolder.getInjector().inject(this);
>    }
>
>   �...@override
>    protected T load(Class clazz, Serializable id) {
>        return (T)dao.get(clazz, (Long)id);
>    };
> }
>
>
> I'd be happy to supply more code (xml files, etc.) if it would be useful. I
> feel that this is about as simple a use case as I can create for the issue.
> Thanks again for all your help!
>
> Dane
>
>
>
> On Sat, Aug 29, 2009 at 7:41 AM, James Carman 
> wrote:
>
>> Aren't they chained based on the order of the filter mapping definitions,
>> not the order of the filter definitions?
>>
>> On Aug 29, 2009 12:40 AM, "Igor Vaynberg"  wrote:
>>
>> filters are executed in the order they are defined, so put the osiv
>> filter declaration before wicket.
>>
>> -igor
>>
>> On Thu, Aug 27, 2009 at 8:08 AM, Dane Laverty
>> wrote:
>> > Thanks for the sugges...
>>
>

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



Re: Quick model/user/session question

2009-08-31 Thread Dane Laverty
Thanks James and Igor for looking it over. Switching the order of the filter
definitions didn't make a difference. If it helps, here's what I'm doing:

1 - This is the UserInfo class. As far as this test case is concerned, it
has an ID and a Set to check lazy loading. I've commented out the
FetchType.EAGER to test the OSIV. When it is uncommented, the UserPage (#2,
below) renders correctly, otherwise I get a lazy load exception.

@Entity
@Table(name = "zjp_user_accounts")
public class UserInfo extends PersonInfo {
@Id
Long id;

@OneToMany(mappedBy="employerInfo" /*, fetch=FetchType.EAGER*/)
Set postedJobs;
...
}


2 - UserPage is the page I'm using to test lazy loading.

public class UserPage extends WebPage {
@SpringBean(name = "personInfoDao")
private PersonInfoDao personInfoDao;

public UserPage() {

EntityModel personInfoModel = new
EntityModel(UserInfo.class, new Long(1));

EmployerInfo personInfo = (EmployerInfo)personInfoModel.getObject();
Set jobs = personInfo.getPostedJobs();
Iterator itr = jobs.iterator();
while (itr.hasNext()) {
System.out.println(itr.next());
}
}
}


3 - And this is the EntityModel, based on the Smart EntityModel article -
http://wicketinaction.com/2008/09/building-a-smart-entitymodel/

public class EntityModel> extends
AbstractEntityModel {

@SpringBean(name = "entityDao")
private EntityDao dao;

public EntityModel(Class clazz, Serializable id) {
super(clazz, id);
// This makes the class Spring-aware, so we can inject the DAOs, as
above
InjectorHolder.getInjector().inject(this);
}

@Override
protected T load(Class clazz, Serializable id) {
return (T)dao.get(clazz, (Long)id);
};
}


I'd be happy to supply more code (xml files, etc.) if it would be useful. I
feel that this is about as simple a use case as I can create for the issue.
Thanks again for all your help!

Dane



On Sat, Aug 29, 2009 at 7:41 AM, James Carman wrote:

> Aren't they chained based on the order of the filter mapping definitions,
> not the order of the filter definitions?
>
> On Aug 29, 2009 12:40 AM, "Igor Vaynberg"  wrote:
>
> filters are executed in the order they are defined, so put the osiv
> filter declaration before wicket.
>
> -igor
>
> On Thu, Aug 27, 2009 at 8:08 AM, Dane Laverty
> wrote:
> > Thanks for the sugges...
>


Re: Quick model/user/session question

2009-08-29 Thread James Carman
Aren't they chained based on the order of the filter mapping definitions,
not the order of the filter definitions?

On Aug 29, 2009 12:40 AM, "Igor Vaynberg"  wrote:

filters are executed in the order they are defined, so put the osiv
filter declaration before wicket.

-igor

On Thu, Aug 27, 2009 at 8:08 AM, Dane Laverty wrote:
> Thanks for the sugges...


Re: Quick model/user/session question

2009-08-28 Thread Igor Vaynberg
filters are executed in the order they are defined, so put the osiv
filter declaration before wicket.

-igor

On Thu, Aug 27, 2009 at 8:08 AM, Dane Laverty wrote:
> Thanks for the suggestion. I've actually already got OpenSessionInViewFilter
> in my web.xml, like so:
>
>    
>        wicket.filter
>
> org.apache.wicket.protocol.http.WicketFilter
>        
>            applicationFactoryClassName
>
> org.apache.wicket.spring.SpringWebApplicationFactory
>        
>    
>
>    
>       open.hibernate.session.in.view
>
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
>    
>
>    
>    
>       open.hibernate.session.in.view
>       /*
>    
>
>    
>        wicket.filter
>        /*
>    
>
> Is there anything else I need to do in order to make OSIV work? Everything
> I've read says it just needs to be placed in the web.xml.
>
> Thanks,
>
> Dane
>
>
>
> On Wed, Aug 26, 2009 at 7:58 PM, Igor Vaynberg wrote:
>
>> On Wed, Aug 26, 2009 at 6:30 PM, Dane Laverty
>> wrote:
>> > As I understand it, the LazyInitializationException is thrown because the
>> > Hibernate session closes after I call EntityDao.load(). But if that's the
>> > problem, then why should an LDM help? Won't the Hibernate session close
>> > again as soon as the LDM's load() is called?
>>
>> google OpenSessionInViewFilter, it keeps the hibernate session open
>> for the entire request.
>>
>> -igor
>>
>> -
>> 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: Quick model/user/session question

2009-08-27 Thread Dane Laverty
Thanks for the suggestion. I've actually already got OpenSessionInViewFilter
in my web.xml, like so:


wicket.filter

org.apache.wicket.protocol.http.WicketFilter

applicationFactoryClassName

org.apache.wicket.spring.SpringWebApplicationFactory




   open.hibernate.session.in.view

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter




   open.hibernate.session.in.view
   /*



wicket.filter
/*


Is there anything else I need to do in order to make OSIV work? Everything
I've read says it just needs to be placed in the web.xml.

Thanks,

Dane



On Wed, Aug 26, 2009 at 7:58 PM, Igor Vaynberg wrote:

> On Wed, Aug 26, 2009 at 6:30 PM, Dane Laverty
> wrote:
> > As I understand it, the LazyInitializationException is thrown because the
> > Hibernate session closes after I call EntityDao.load(). But if that's the
> > problem, then why should an LDM help? Won't the Hibernate session close
> > again as soon as the LDM's load() is called?
>
> google OpenSessionInViewFilter, it keeps the hibernate session open
> for the entire request.
>
> -igor
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Quick model/user/session question

2009-08-26 Thread Igor Vaynberg
On Wed, Aug 26, 2009 at 6:30 PM, Dane Laverty wrote:
> As I understand it, the LazyInitializationException is thrown because the
> Hibernate session closes after I call EntityDao.load(). But if that's the
> problem, then why should an LDM help? Won't the Hibernate session close
> again as soon as the LDM's load() is called?

google OpenSessionInViewFilter, it keeps the hibernate session open
for the entire request.

-igor

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



Re: Quick model/user/session question

2009-08-26 Thread Dane Laverty
More progress and another brick wall. After spending too many hours
researching connection pools, it looks like the problem was actually a lack
of @Transactional on the DAO method used by the EntityModel. Now I've added
@Transactional, but that puts me back to getting the
LazyInitializationException when I access one of PersonInfo's lazily loaded
properties. Ugh...

So now my question goes back to the smart EntityModel approach (as per
http://wicketinaction.com/2008/09/building-a-smart-entitymodel/ ). When I
search the mailing list, I see LDM/EntityModel given as the solution for
LazyInitializationException. I don't understand why wrapping the object in a
model should help (and in my case it doesn't help, probably because I'm
implementing it wrong).

As I understand it, the LazyInitializationException is thrown because the
Hibernate session closes after I call EntityDao.load(). But if that's the
problem, then why should an LDM help? Won't the Hibernate session close
again as soon as the LDM's load() is called?

well, regardless, let me echo Nino's tagline and say, "Wicket for love!" As
frustrating as this is, I know it would be ten times more frustrating back
in Struts-land, where I'm from.


Dane



On Tue, Aug 25, 2009 at 3:53 PM, Dane Laverty  wrote:

> Good point. Now that I've switched to c3p0, I'm getting more debug info,
> i.e.:
>
> DEBUG - BasicResourcePool - [managed: 3, unused: 1, excluded: 0]
> DEBUG - BasicResourcePool - [managed: 3, unused: 0, excluded: 0]
> DEBUG - BasicResourcePool - [managed: 4, unused: 1, excluded: 0]
> DEBUG - BasicResourcePool - [managed: 4, unused: 0, excluded: 0]
> ...
> DEBUG - BasicResourcePool - [managed: 15, unused: 0, excluded: 0]
> DEBUG - BasicResourcePool - acquire test -- pool is already maxed out.
> [managed: 15; max: 15]
>
> It turns out that the problem has nothing to do with clicking really fast.
> After 15 clicks on any of the links in the app, it will freeze. I'm using
> wicket-auth for security, so the EntityModel is inflating the
> UserInfo object on every page to check for permissions, and the connections
> are not being released. This was not an issue before I moved my UserInfo
> into the detachable EntityModel. I'll do some more research.
>
> Dane
>
>
>
>
> On Tue, Aug 25, 2009 at 3:34 PM, Edward Zarecor 
> wrote:
>
>> There's no connection pool size defined.  Is the default pool size for
>> dbcp
>> 1?
>>
>> Ed.
>>
>> On Aug 25, 2009 5:29 PM, "Dane Laverty"  wrote:
>>
>> I'm using dbcp, as per below. I'll try switching over to c3p0 and see if
>> that helps.
>>
>>   > class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
>>   
>>   
>>   
>>   
>>   
>>
>>
>> On Tue, Aug 25, 2009 at 2:25 PM, Martijn Dashorst <
>>
>> martijn.dasho...@gmail.com> wrote: > Do you use a connection pool? e.g.
>> datasource definition in yo...
>>
>
>


Re: Quick model/user/session question

2009-08-25 Thread Dane Laverty
Good point. Now that I've switched to c3p0, I'm getting more debug info,
i.e.:

DEBUG - BasicResourcePool - [managed: 3, unused: 1, excluded: 0]
DEBUG - BasicResourcePool - [managed: 3, unused: 0, excluded: 0]
DEBUG - BasicResourcePool - [managed: 4, unused: 1, excluded: 0]
DEBUG - BasicResourcePool - [managed: 4, unused: 0, excluded: 0]
...
DEBUG - BasicResourcePool - [managed: 15, unused: 0, excluded: 0]
DEBUG - BasicResourcePool - acquire test -- pool is already maxed out.
[managed: 15; max: 15]

It turns out that the problem has nothing to do with clicking really fast.
After 15 clicks on any of the links in the app, it will freeze. I'm using
wicket-auth for security, so the EntityModel is inflating the
UserInfo object on every page to check for permissions, and the connections
are not being released. This was not an issue before I moved my UserInfo
into the detachable EntityModel. I'll do some more research.

Dane



On Tue, Aug 25, 2009 at 3:34 PM, Edward Zarecor wrote:

> There's no connection pool size defined.  Is the default pool size for dbcp
> 1?
>
> Ed.
>
> On Aug 25, 2009 5:29 PM, "Dane Laverty"  wrote:
>
> I'm using dbcp, as per below. I'll try switching over to c3p0 and see if
> that helps.
>
>class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
>   
>   
>   
>   
>   
>
>
> On Tue, Aug 25, 2009 at 2:25 PM, Martijn Dashorst <
>
> martijn.dasho...@gmail.com> wrote: > Do you use a connection pool? e.g.
> datasource definition in yo...
>


Re: Quick model/user/session question

2009-08-25 Thread Edward Zarecor
There's no connection pool size defined.  Is the default pool size for dbcp
1?

Ed.

On Aug 25, 2009 5:29 PM, "Dane Laverty"  wrote:

I'm using dbcp, as per below. I'll try switching over to c3p0 and see if
that helps.

   
   
   
   
   
   


On Tue, Aug 25, 2009 at 2:25 PM, Martijn Dashorst <

martijn.dasho...@gmail.com> wrote: > Do you use a connection pool? e.g.
datasource definition in yo...


Re: Quick model/user/session question

2009-08-25 Thread Dane Laverty
I'm using dbcp, as per below. I'll try switching over to c3p0 and see if
that helps.









On Tue, Aug 25, 2009 at 2:25 PM, Martijn Dashorst <
martijn.dasho...@gmail.com> wrote:

> Do you use a connection pool? e.g. datasource definition in your
> container, dbcp or c3p0? If not, use one.
>
> Martijn
>
> On Tue, Aug 25, 2009 at 11:10 PM, Dane Laverty
> wrote:
> > I think I've discovered the source of the problem, but not the solution.
> On
> > a normal page request, the console output says:
> >
> >   DEBUG - log- REQUEST /post-job on
> > org.mortbay.jetty.httpconnect...@1b9db06 ...
> >   DEBUG - ConnectionManager  - opening JDBC connection
> >   DEBUG - SQL- select
> > jobcategor0_.job_category_id...
> >
> > And everything goes normally from there. But on double-clicking the link,
> > the console says:
> >
> >   DEBUG - log- REQUEST /post-job on
> > org.mortbay.jetty.httpconnect...@1b9db06 ...
> >   DEBUG - ConnectionManager  - opening JDBC connection
> >   DEBUG - log- REQUEST /post-job on
> > org.mortbay.jetty.httpconnect...@a78af0 ...
> >   DEBUG - ConnectionManager  - opening JDBC connection
> >
> > And then the application freezes. Apparently it is trying to open a
> second
> > JDBC connection before the first one closed, and something doesn't like
> > that. I'm not sure where to start looking to solve this -- any
> suggestions?
> >
> > thanks again,
> >
> > Dane
> >
> >
> >
> > On Tue, Aug 25, 2009 at 1:22 PM, Dane Laverty 
> wrote:
> >
> >> Progress is being made. Thanks again for your suggestion, Martijn. I
> >> discovered this thread (
> >>
> http://www.nabble.com/Storing-user-entity-in-session--td22113666.html#a22113666)
> where you discussed putting the user in the RequestCycle in some more
> >> detail. That helped me rebuild my RequestCycle [1].
> >>
> >> The new RequestCycle solved the LazyInitializationException, but created
> a
> >> new problem. The application runs fine, but if I click a link twice in
> rapid
> >> succession, the application hangs for all users until I restart the
> server.
> >> This is kind of a major problem :) I've pasted the server output below
> [2].
> >> The console stops on the line "DEBUG - ConnectionManager - opening JDBC
> >> connection" for a couple minutes, then throws the
> "java.net.SocketException:
> >> Connection reset" stack trace.
> >>
> >> Googling "java.net.SocketException: Connection reset" shows that the
> error
> >> is connected to a wide array of issues. Has anyone here run into the
> problem
> >> before? And if so, how did you solve it?
> >>
> >> thanks,
> >>
> >> Dane
> >>
> >> ---
> >>
> >> [1] - public class WicketRequestCycle extends WebRequestCycle implements
> >> Serializable {
> >>
> >> EntityModel userInfoModel;
> >> ...
> >> public UserInfo getUserInfo() {
> >> if (userInfoModel != null) return userInfoModel.getObject();
> >> UserInfo userInfo = WicketSession.get().generateUserInfo();
> >> if (userInfo == null) return null;
> >> userInfoModel = new EntityModel(userInfo);
> >> return userInfoModel.getObject();
> >> }
> >>
> >> @Override
> >> public void detach() {
> >> super.detach();
> >> if (userInfoModel != null)
> >> userInfoModel.detach();
> >> }
> >> }
> >>
> >>
> >> [2] - TRACE - SessionImpl- closing session
> >> TRACE - ConnectionManager  - connection already null in cleanup
> :
> >> no action
> >> DEBUG - log- RESPONSE /images/lotus.png  200
> >> DEBUG - log- REQUEST /login on
> >> org.mortbay.jetty.httpconnect...@7d0f44
> >> DEBUG - log- Got Session ID 1haooq2s24av1 from
> >> cookie
> >> DEBUG - log-
> >> sessionmanager=org.mortbay.jetty.servlet.hashsessionmana...@3411a
> >> DEBUG - log-
> >>
> session=org.mortbay.jetty.servlet.HashSessionManager$Session:1haooq2s24...@18296160
> >> DEBUG - log- servlet=default
> >> DEBUG - log-
> >> chain=open.hibernate.session.in.view->wicket.careerconnect->default
> >> DEBUG - log- servelet holder=default
> >> DEBUG - log- call filter
> >> open.hibernate.session.in.view
> >> DEBUG - OpenSessionInViewFilter- Using SessionFactory
> 'sessionFactory'
> >> for OpenSessionInViewFilter
> >> DEBUG - DefaultListableBeanFactory - Returning cached instance of
> singleton
> >> bean 'sessionFactory'
> >> DEBUG - OpenSessionInViewFilter- Opening single Hibernate Session in
> >> OpenSessionInViewFilter
> >> DEBUG - SessionFactoryUtils- Opening Hibernate Session
> >> DEBUG - SessionImpl- opened session at timestamp:
> >> 5125043523203072
> >> TRACE - SessionImpl- setting 

Re: Quick model/user/session question

2009-08-25 Thread Martijn Dashorst
Do you use a connection pool? e.g. datasource definition in your
container, dbcp or c3p0? If not, use one.

Martijn

On Tue, Aug 25, 2009 at 11:10 PM, Dane Laverty wrote:
> I think I've discovered the source of the problem, but not the solution. On
> a normal page request, the console output says:
>
>   DEBUG - log                        - REQUEST /post-job on
> org.mortbay.jetty.httpconnect...@1b9db06 ...
>   DEBUG - ConnectionManager          - opening JDBC connection
>   DEBUG - SQL                        - select
> jobcategor0_.job_category_id...
>
> And everything goes normally from there. But on double-clicking the link,
> the console says:
>
>   DEBUG - log                        - REQUEST /post-job on
> org.mortbay.jetty.httpconnect...@1b9db06 ...
>   DEBUG - ConnectionManager          - opening JDBC connection
>   DEBUG - log                        - REQUEST /post-job on
> org.mortbay.jetty.httpconnect...@a78af0 ...
>   DEBUG - ConnectionManager          - opening JDBC connection
>
> And then the application freezes. Apparently it is trying to open a second
> JDBC connection before the first one closed, and something doesn't like
> that. I'm not sure where to start looking to solve this -- any suggestions?
>
> thanks again,
>
> Dane
>
>
>
> On Tue, Aug 25, 2009 at 1:22 PM, Dane Laverty  wrote:
>
>> Progress is being made. Thanks again for your suggestion, Martijn. I
>> discovered this thread (
>> http://www.nabble.com/Storing-user-entity-in-session--td22113666.html#a22113666)
>>  where you discussed putting the user in the RequestCycle in some more
>> detail. That helped me rebuild my RequestCycle [1].
>>
>> The new RequestCycle solved the LazyInitializationException, but created a
>> new problem. The application runs fine, but if I click a link twice in rapid
>> succession, the application hangs for all users until I restart the server.
>> This is kind of a major problem :) I've pasted the server output below [2].
>> The console stops on the line "DEBUG - ConnectionManager - opening JDBC
>> connection" for a couple minutes, then throws the "java.net.SocketException:
>> Connection reset" stack trace.
>>
>> Googling "java.net.SocketException: Connection reset" shows that the error
>> is connected to a wide array of issues. Has anyone here run into the problem
>> before? And if so, how did you solve it?
>>
>> thanks,
>>
>> Dane
>>
>> ---
>>
>> [1] - public class WicketRequestCycle extends WebRequestCycle implements
>> Serializable {
>>
>>     EntityModel userInfoModel;
>>     ...
>>     public UserInfo getUserInfo() {
>>         if (userInfoModel != null) return userInfoModel.getObject();
>>         UserInfo userInfo = WicketSession.get().generateUserInfo();
>>         if (userInfo == null) return null;
>>         userInfoModel = new EntityModel(userInfo);
>>         return userInfoModel.getObject();
>>     }
>>
>>     @Override
>>     public void detach() {
>>         super.detach();
>>         if (userInfoModel != null)
>>             userInfoModel.detach();
>>     }
>> }
>>
>>
>> [2] - TRACE - SessionImpl                - closing session
>> TRACE - ConnectionManager          - connection already null in cleanup :
>> no action
>> DEBUG - log                        - RESPONSE /images/lotus.png  200
>> DEBUG - log                        - REQUEST /login on
>> org.mortbay.jetty.httpconnect...@7d0f44
>> DEBUG - log                        - Got Session ID 1haooq2s24av1 from
>> cookie
>> DEBUG - log                        -
>> sessionmanager=org.mortbay.jetty.servlet.hashsessionmana...@3411a
>> DEBUG - log                        -
>> session=org.mortbay.jetty.servlet.HashSessionManager$Session:1haooq2s24...@18296160
>> DEBUG - log                        - servlet=default
>> DEBUG - log                        -
>> chain=open.hibernate.session.in.view->wicket.careerconnect->default
>> DEBUG - log                        - servelet holder=default
>> DEBUG - log                        - call filter
>> open.hibernate.session.in.view
>> DEBUG - OpenSessionInViewFilter    - Using SessionFactory 'sessionFactory'
>> for OpenSessionInViewFilter
>> DEBUG - DefaultListableBeanFactory - Returning cached instance of singleton
>> bean 'sessionFactory'
>> DEBUG - OpenSessionInViewFilter    - Opening single Hibernate Session in
>> OpenSessionInViewFilter
>> DEBUG - SessionFactoryUtils        - Opening Hibernate Session
>> DEBUG - SessionImpl                - opened session at timestamp:
>> 5125043523203072
>> TRACE - SessionImpl                - setting flush mode to: NEVER
>> DEBUG - tionSynchronizationManager - Bound value
>> [org.springframework.orm.hibernate3.sessionhol...@117a49c] for key
>> [org.hibernate.impl.sessionfactoryi...@737f58] to thread [btpool0-4 -
>> /login;jsessionid=1haooq2s24av1?wicket:interface=:0:loginForm::IFormSubmitListener::]
>> DEBUG - log                        - call filter wicket.careerconnect
>> DEBUG - SessionFactoryUtils        - Opening Hibernate Session
>> DEBUG - SessionImpl      

Re: Quick model/user/session question

2009-08-25 Thread Dane Laverty
I think I've discovered the source of the problem, but not the solution. On
a normal page request, the console output says:

   DEBUG - log- REQUEST /post-job on
org.mortbay.jetty.httpconnect...@1b9db06 ...
   DEBUG - ConnectionManager  - opening JDBC connection
   DEBUG - SQL- select
jobcategor0_.job_category_id...

And everything goes normally from there. But on double-clicking the link,
the console says:

   DEBUG - log- REQUEST /post-job on
org.mortbay.jetty.httpconnect...@1b9db06 ...
   DEBUG - ConnectionManager  - opening JDBC connection
   DEBUG - log- REQUEST /post-job on
org.mortbay.jetty.httpconnect...@a78af0 ...
   DEBUG - ConnectionManager  - opening JDBC connection

And then the application freezes. Apparently it is trying to open a second
JDBC connection before the first one closed, and something doesn't like
that. I'm not sure where to start looking to solve this -- any suggestions?

thanks again,

Dane



On Tue, Aug 25, 2009 at 1:22 PM, Dane Laverty  wrote:

> Progress is being made. Thanks again for your suggestion, Martijn. I
> discovered this thread (
> http://www.nabble.com/Storing-user-entity-in-session--td22113666.html#a22113666)
>  where you discussed putting the user in the RequestCycle in some more
> detail. That helped me rebuild my RequestCycle [1].
>
> The new RequestCycle solved the LazyInitializationException, but created a
> new problem. The application runs fine, but if I click a link twice in rapid
> succession, the application hangs for all users until I restart the server.
> This is kind of a major problem :) I've pasted the server output below [2].
> The console stops on the line "DEBUG - ConnectionManager - opening JDBC
> connection" for a couple minutes, then throws the "java.net.SocketException:
> Connection reset" stack trace.
>
> Googling "java.net.SocketException: Connection reset" shows that the error
> is connected to a wide array of issues. Has anyone here run into the problem
> before? And if so, how did you solve it?
>
> thanks,
>
> Dane
>
> ---
>
> [1] - public class WicketRequestCycle extends WebRequestCycle implements
> Serializable {
>
> EntityModel userInfoModel;
> ...
> public UserInfo getUserInfo() {
> if (userInfoModel != null) return userInfoModel.getObject();
> UserInfo userInfo = WicketSession.get().generateUserInfo();
> if (userInfo == null) return null;
> userInfoModel = new EntityModel(userInfo);
> return userInfoModel.getObject();
> }
>
> @Override
> public void detach() {
> super.detach();
> if (userInfoModel != null)
> userInfoModel.detach();
> }
> }
>
>
> [2] - TRACE - SessionImpl- closing session
> TRACE - ConnectionManager  - connection already null in cleanup :
> no action
> DEBUG - log- RESPONSE /images/lotus.png  200
> DEBUG - log- REQUEST /login on
> org.mortbay.jetty.httpconnect...@7d0f44
> DEBUG - log- Got Session ID 1haooq2s24av1 from
> cookie
> DEBUG - log-
> sessionmanager=org.mortbay.jetty.servlet.hashsessionmana...@3411a
> DEBUG - log-
> session=org.mortbay.jetty.servlet.HashSessionManager$Session:1haooq2s24...@18296160
> DEBUG - log- servlet=default
> DEBUG - log-
> chain=open.hibernate.session.in.view->wicket.careerconnect->default
> DEBUG - log- servelet holder=default
> DEBUG - log- call filter
> open.hibernate.session.in.view
> DEBUG - OpenSessionInViewFilter- Using SessionFactory 'sessionFactory'
> for OpenSessionInViewFilter
> DEBUG - DefaultListableBeanFactory - Returning cached instance of singleton
> bean 'sessionFactory'
> DEBUG - OpenSessionInViewFilter- Opening single Hibernate Session in
> OpenSessionInViewFilter
> DEBUG - SessionFactoryUtils- Opening Hibernate Session
> DEBUG - SessionImpl- opened session at timestamp:
> 5125043523203072
> TRACE - SessionImpl- setting flush mode to: NEVER
> DEBUG - tionSynchronizationManager - Bound value
> [org.springframework.orm.hibernate3.sessionhol...@117a49c] for key
> [org.hibernate.impl.sessionfactoryi...@737f58] to thread [btpool0-4 -
> /login;jsessionid=1haooq2s24av1?wicket:interface=:0:loginForm::IFormSubmitListener::]
> DEBUG - log- call filter wicket.careerconnect
> DEBUG - SessionFactoryUtils- Opening Hibernate Session
> DEBUG - SessionImpl- opened session at timestamp:
> 5125043523203073
> TRACE - QueryPlanCache - located HQL query plan in cache (
> select employerInfo  from EmployerInfo as employerInfo  inner join
> employerInfo.contactPoints as contactPoints  where contactPoints.contactInfo
> = ?  and emplo

Re: Quick model/user/session question

2009-08-25 Thread Dane Laverty
Progress is being made. Thanks again for your suggestion, Martijn. I
discovered this thread (
http://www.nabble.com/Storing-user-entity-in-session--td22113666.html#a22113666)
where you discussed putting the user in the RequestCycle in some more
detail. That helped me rebuild my RequestCycle [1].

The new RequestCycle solved the LazyInitializationException, but created a
new problem. The application runs fine, but if I click a link twice in rapid
succession, the application hangs for all users until I restart the server.
This is kind of a major problem :) I've pasted the server output below [2].
The console stops on the line "DEBUG - ConnectionManager - opening JDBC
connection" for a couple minutes, then throws the "java.net.SocketException:
Connection reset" stack trace.

Googling "java.net.SocketException: Connection reset" shows that the error
is connected to a wide array of issues. Has anyone here run into the problem
before? And if so, how did you solve it?

thanks,

Dane

---

[1] - public class WicketRequestCycle extends WebRequestCycle implements
Serializable {

EntityModel userInfoModel;
...
public UserInfo getUserInfo() {
if (userInfoModel != null) return userInfoModel.getObject();
UserInfo userInfo = WicketSession.get().generateUserInfo();
if (userInfo == null) return null;
userInfoModel = new EntityModel(userInfo);
return userInfoModel.getObject();
}

@Override
public void detach() {
super.detach();
if (userInfoModel != null)
userInfoModel.detach();
}
}


[2] - TRACE - SessionImpl- closing session
TRACE - ConnectionManager  - connection already null in cleanup : no
action
DEBUG - log- RESPONSE /images/lotus.png  200
DEBUG - log- REQUEST /login on
org.mortbay.jetty.httpconnect...@7d0f44
DEBUG - log- Got Session ID 1haooq2s24av1 from
cookie
DEBUG - log-
sessionmanager=org.mortbay.jetty.servlet.hashsessionmana...@3411a
DEBUG - log-
session=org.mortbay.jetty.servlet.HashSessionManager$Session:1haooq2s24...@18296160
DEBUG - log- servlet=default
DEBUG - log-
chain=open.hibernate.session.in.view->wicket.careerconnect->default
DEBUG - log- servelet holder=default
DEBUG - log- call filter
open.hibernate.session.in.view
DEBUG - OpenSessionInViewFilter- Using SessionFactory 'sessionFactory'
for OpenSessionInViewFilter
DEBUG - DefaultListableBeanFactory - Returning cached instance of singleton
bean 'sessionFactory'
DEBUG - OpenSessionInViewFilter- Opening single Hibernate Session in
OpenSessionInViewFilter
DEBUG - SessionFactoryUtils- Opening Hibernate Session
DEBUG - SessionImpl- opened session at timestamp:
5125043523203072
TRACE - SessionImpl- setting flush mode to: NEVER
DEBUG - tionSynchronizationManager - Bound value
[org.springframework.orm.hibernate3.sessionhol...@117a49c] for key
[org.hibernate.impl.sessionfactoryi...@737f58] to thread [btpool0-4 -
/login;jsessionid=1haooq2s24av1?wicket:interface=:0:loginForm::IFormSubmitListener::]
DEBUG - log- call filter wicket.careerconnect
DEBUG - SessionFactoryUtils- Opening Hibernate Session
DEBUG - SessionImpl- opened session at timestamp:
5125043523203073
TRACE - QueryPlanCache - located HQL query plan in cache (
select employerInfo  from EmployerInfo as employerInfo  inner join
employerInfo.contactPoints as contactPoints  where contactPoints.contactInfo
= ?  and employerInfo.password = md5_digest(?))
TRACE - QueryPlanCache - located HQL query plan in cache (
select employerInfo  from EmployerInfo as employerInfo  inner join
employerInfo.contactPoints as contactPoints  where contactPoints.contactInfo
= ?  and employerInfo.password = md5_digest(?))
TRACE - HQLQueryPlan   - find:  select employerInfo  from
EmployerInfo as employerInfo  inner join employerInfo.contactPoints as
contactPoints  where contactPoints.contactInfo = ?  and
employerInfo.password = md5_digest(?)
TRACE - QueryParameters- parameters: [dane, asdf]
TRACE - QueryParameters- named parameters: {}
DEBUG - AbstractBatcher- about to open PreparedStatement (open
PreparedStatements: 0, globally: 4)
DEBUG - ConnectionManager  - opening JDBC connection
DEBUG - log- EXCEPTION
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at org.mortbay.io.ByteArrayBuffer.readFrom(ByteArrayBuffer.java:172)
at org.mortbay.io.bio.StreamEndPoint.fill(StreamEndPoint.java:107)
at
org.mortbay.jetty.bio.SocketConnector$Connection.fill(SocketConnector.java:196)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java

Re: Quick model/user/session question

2009-08-24 Thread Dane Laverty
I took your advice and added a UserInfo variable to the RequestCycle [1].
Now my pages look for the UserInfo in the RequestCycle. If it's null, the
RequestCycle loads it from the ID in Session [2]. However, I still get the
LazyInitializationException when a page wants to access a collection from
userInfo [3], presumably because the Hibernate session was closed after the
Session loads the UserInfo. I thought that the OpenSessionInViewFilter was
supposed to keep the session open during the entire request, but apparently
I'm using it wrong.

[1] - public class WicketRequestCycle extends WebRequestCycle implements
Serializable {

UserInfo userInfo;
...
public UserInfo getUserInfo() {
if (userInfo != null) return userInfo;
userInfo = WicketSession.get().generateUserInfo();
return userInfo;
}
}


[2] - public class WicketSession extends AuthenticatedWebSession {

@SpringBean(name = "userInfoDao")
private UserInfoDao userInfoDao;

private Long userInfoID;
...
public UserInfo generateUserInfo() {
if (userInfoID == null) return null;
return personInfoDao.load(personInfoId, personInfoClass);
}
}

[3] - public class UserRolesAuthorizer implements IRoleCheckingStrategy
{
public boolean hasAnyRole(Roles roles)
{
PersonInfo personInfo = WicketRequestCycle.get().getPersonInfo();
// THIS NEXT LINE THROWS THE ERROR, since it's trying to load
BasicUser
return userInfo.getBasicUser().hasAnyRole(roles);
}

}


On Mon, Aug 24, 2009 at 2:12 PM, Martijn Dashorst <
martijn.dasho...@gmail.com> wrote:

> Don't put the models in your session! Session access is not guaranteed
> to be confined to a single thread - multi window support, resources
> and such all attach the session to their own threads, making the
> session non-thread safe.
>
> Best option is to put the ID of your entities in your session object,
> and store the entities in your request cycle for request processing.
>
> Martijn
>
> On Mon, Aug 24, 2009 at 9:21 PM, Dane Laverty
> wrote:
> > I understand that a Hibernate-generated object needs to be kept in a
> > LoadableDetachableModel in order to avoid errors across requests. I also
> > understand that a LDM has to belong to a component in order for its
> detach
> > to be called at the end of a request. So what should I do with
> > Hibernate-generated objects that live in the session, specifically a
> > UserInfo object? Since the session doesn't have a model, how do I inform
> > Wicket to detach these models after each request?
> >
> > thanks,
> >
> > Dane
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Quick model/user/session question

2009-08-24 Thread Dane Laverty
Do you mean that the database should be queried for every persistent session
object on every request?

On Mon, Aug 24, 2009 at 2:12 PM, Martijn Dashorst <
martijn.dasho...@gmail.com> wrote:

> Don't put the models in your session! Session access is not guaranteed
> to be confined to a single thread - multi window support, resources
> and such all attach the session to their own threads, making the
> session non-thread safe.
>
> Best option is to put the ID of your entities in your session object,
> and store the entities in your request cycle for request processing.
>
> Martijn
>
> On Mon, Aug 24, 2009 at 9:21 PM, Dane Laverty
> wrote:
> > I understand that a Hibernate-generated object needs to be kept in a
> > LoadableDetachableModel in order to avoid errors across requests. I also
> > understand that a LDM has to belong to a component in order for its
> detach
> > to be called at the end of a request. So what should I do with
> > Hibernate-generated objects that live in the session, specifically a
> > UserInfo object? Since the session doesn't have a model, how do I inform
> > Wicket to detach these models after each request?
> >
> > thanks,
> >
> > Dane
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Quick model/user/session question

2009-08-24 Thread Martijn Dashorst
Don't put the models in your session! Session access is not guaranteed
to be confined to a single thread - multi window support, resources
and such all attach the session to their own threads, making the
session non-thread safe.

Best option is to put the ID of your entities in your session object,
and store the entities in your request cycle for request processing.

Martijn

On Mon, Aug 24, 2009 at 9:21 PM, Dane Laverty wrote:
> I understand that a Hibernate-generated object needs to be kept in a
> LoadableDetachableModel in order to avoid errors across requests. I also
> understand that a LDM has to belong to a component in order for its detach
> to be called at the end of a request. So what should I do with
> Hibernate-generated objects that live in the session, specifically a
> UserInfo object? Since the session doesn't have a model, how do I inform
> Wicket to detach these models after each request?
>
> thanks,
>
> Dane
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0

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