[Resin-interest] Hibernate lazy loading with Quercus

2009-11-23 Thread Vincent LAUGIER
Title: Vincent LAUGIER




Hello,

we try to do the following on our php/EJB3 application :

  find a given client from its lastname using a stateless bean ()
  
  load his orders using the getter


[code]
$clients = $client_eao-findBySample($sample_client,false,false);
var_dump($clients[0]-getOrders());
[/code]

We get the usual LazyInitializationException :
[10:41:03.300] {http--8080-6$31582617}
org.hibernate.LazyInitializationException: failed to lazily initialize
a collection of role: com.opticneo.entity.client.Client.orders, no
session or session was closed

If we were using Hessian, before returning the list of clients we would
have made a copy of the list (using beanlib) before it is serialized
(in ordre to avoid LazyInitializationException)
With Quercus, we do not have to do this. Good ! But we face the
LazyInitializationException again when trying to access the complex
attributes.

What is the best way to handle this ? (maybe by taking control over the
transaction from the php)

Thanks for your help.

Regards

-- 




  

   Vincent LAUGIER 
Email : vincent.laug...@helmet.fr
Tlphone : + 33 (0)1 75 43 92 52
Fax : + 33 (0)1 79 75 01 12 (monfax.com)
  


  




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] Resin 3.1.9 behind apache's ProxyPass problem

2009-11-23 Thread smallufo
Hi , I am running resin 3.1.9 in my db server , with host name 'db' and
private IP address (192.168.x.x).
In the frontend , apache httpd redirect '/servlet' pattern to the backend db
with the two lines :

ProxyPass /servlet http://db:8080/servlet
ProxyPassReverse /servlet http://db:8080/servlet


In my servlet , I want to output a valid URL , linking to the webapp's some
resources/apps
But how do I get the correct [frontend] server name and port , instead of
'db' and '8080' ?

In the resin.conf , I tried a lot of configuration ,
but all got : req.getServerName() = db , and req.getServerPort() = 8080

I need a correct URL , such as 'http://www.foobar.com/servlet/ooxx' , not
http://db:8080/servlet/ooxx

I tried some configurations , but all in vain :

host id= host-name=www.foobar.com
root-directory=/home/foobar/www
  host-aliasdb/host-alias
  web-app id=/ root-directory=./
/host

and :

host id=db host-name=www.foobar.com
root-directory=/home/foobar/www
  web-app id=/ root-directory=./
/host

and :

host id= host-name=www.foobar.com
root-directory=/home/foobar/www
  web-app id=/ root-directory=./
/host

and :

host id= host-name=db root-directory=/home/foobar/www
  web-app id=/ root-directory=./
/host

and :

host id=db root-directory=/home/foobar/www
  web-app id=/ root-directory=./
/host


I am running out of ideas ...
Can somebody help me ? Thanks in advanced !
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Hibernate lazy loading with Quercus

2009-11-23 Thread Alex
 Hello,
 
 we try to do the following on our php/EJB3 application :
   • find a given client from its lastname using a stateless bean ()
   • load his orders using the getter
 
 [code]
 $clients = $client_eao-findBySample($sample_client,false,false);
 var_dump($clients[0]-getOrders());
 [/code]

Seems that the objects no longer have the association with valid session, so 
either the Session or PersistenceManager should be kept around to fill the 
objects in upon use. Forcing eager load could also be used I think.

Alex.
 
 We get the usual LazyInitializationException :
 [10:41:03.300] {http--8080-6$31582617} 
 org.hibernate.LazyInitializationException: failed to lazily initialize a 
 collection of role: com.opticneo.entity.client.Client.orders, no session or 
 session was closed
 
 If we were using Hessian, before returning the list of clients we would have 
 made a copy of the list (using beanlib) before it is serialized (in ordre to 
 avoid LazyInitializationException)
 With Quercus, we do not have to do this. Good ! But we face the 
 LazyInitializationException again when trying to access the complex 
 attributes.
 
 What is the best way to handle this ? (maybe by taking control over the 
 transaction from the php)
 
 Thanks for your help.
 
 Regards
 
 -- 
 Vincent LAUGIER 
 Email : vincent.laug...@helmet.fr
 Téléphone : + 33 (0)1 75 43 92 52
 Fax : + 33 (0)1 79 75 01 12 (monfax.com)
 objectwiz-logo_pgday_PREZ.png 
 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Resin 3.1.9 behind apache's ProxyPass problem

2009-11-23 Thread smallufo
2009/11/24 Alex a...@caucho.com

 ProxyPreserveHost


Wow ,

It works !!!

Thank you very much !
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Hibernate lazy loading with Quercus

2009-11-23 Thread Mattias Jiderhamn

Alex wrote (2009-11-24 06:01):

Hello,

we try to do the following on our php/EJB3 application :
• find a given client from its lastname using a stateless bean ()
• load his orders using the getter

[code]
$clients = $client_eao-findBySample($sample_client,false,false);
var_dump($clients[0]-getOrders());
[/code]



Seems that the objects no longer have the association with valid session, so 
either the Session or PersistenceManager should be kept around to fill the 
objects in upon use. Forcing eager load could also be used I think.

Alex.
  


I assume the easiest route here is to use a Filter to achieve 
session/transaction per request.


/Mattias


We get the usual LazyInitializationException :
[10:41:03.300] {http--8080-6$31582617} 
org.hibernate.LazyInitializationException: failed to lazily initialize a 
collection of role: com.opticneo.entity.client.Client.orders, no session or 
session was closed

If we were using Hessian, before returning the list of clients we would have 
made a copy of the list (using beanlib) before it is serialized (in ordre to 
avoid LazyInitializationException)
With Quercus, we do not have to do this. Good ! But we face the 
LazyInitializationException again when trying to access the complex attributes.

What is the best way to handle this ? (maybe by taking control over the 
transaction from the php)

Thanks for your help.

Regards

--
Vincent LAUGIER 




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest