Re: Struts 6.1.1. // Ok to migrate to JDK 17, Spring 6, Hibernate 6?

2023-03-01 Thread John
I believe Spring6 and Hibernate6 are the branches including the JDK17 
javax to jakarta change.


John

On 3/1/2023 7:31 AM, Burton Rhodes wrote:
Well that's a good start.  We may begin testing this to see what 
happens.  Lukasz - many thanks as always.



-- Original Message --

From "Lukasz Lenart" 

To "Struts Users Mailing List" 
Date 3/1/2023 1:12:27 AM
Subject Re: Struts 6.1.1. // Ok to migrate to JDK 17, Spring 6, 
Hibernate 6?


wt., 28 lut 2023 o 13:11 Burton Rhodes  
napisał(a):


 Our team is considering a migration to Spring 6 and Hibernate 6 - 
which
 require JDK 17 and use the new jakarta packages (among other 
things). Is
 there anything within Struts 6.1.1 that would prevent such a 
migration?


Rather no, yet I'm not sure if Spring 6 and Hibernate do not require 
Jakarta API



Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



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



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



Re: Struts 6.1.1. // Ok to migrate to JDK 17, Spring 6, Hibernate 6?

2023-03-01 Thread Burton Rhodes
Well that's a good start.  We may begin testing this to see what 
happens.  Lukasz - many thanks as always.



-- Original Message --

From "Lukasz Lenart" 

To "Struts Users Mailing List" 
Date 3/1/2023 1:12:27 AM
Subject Re: Struts 6.1.1. // Ok to migrate to JDK 17, Spring 6, 
Hibernate 6?



wt., 28 lut 2023 o 13:11 Burton Rhodes  napisał(a):


 Our team is considering a migration to Spring 6 and Hibernate 6 - which
 require JDK 17 and use the new jakarta packages (among other things). Is
 there anything within Struts 6.1.1 that would prevent such a migration?


Rather no, yet I'm not sure if Spring 6 and Hibernate do not require Jakarta API


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



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



Re: Struts 6.1.1. // Ok to migrate to JDK 17, Spring 6, Hibernate 6?

2023-02-28 Thread Lukasz Lenart
wt., 28 lut 2023 o 13:11 Burton Rhodes  napisał(a):
>
> Our team is considering a migration to Spring 6 and Hibernate 6 - which
> require JDK 17 and use the new jakarta packages (among other things). Is
> there anything within Struts 6.1.1 that would prevent such a migration?

Rather no, yet I'm not sure if Spring 6 and Hibernate do not require Jakarta API


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Struts 6.1.1. // Ok to migrate to JDK 17, Spring 6, Hibernate 6?

2023-02-28 Thread Burton Rhodes
Our team is considering a migration to Spring 6 and Hibernate 6 - which
require JDK 17 and use the new jakarta packages (among other things). Is
there anything within Struts 6.1.1 that would prevent such a migration?


Re: Struts2 JQuery plugin failed on Strut2 + Tiles + Hibernate project

2017-02-13 Thread Dave Newton
On Mon, Feb 13, 2017 at 11:24 AM, THAN_HVFC 
wrote:

> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
>



   - org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter


-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton 
b: Bucky Bits 
g: davelnewton 
so: Dave Newton 


Struts2 JQuery plugin failed on Strut2 + Tiles + Hibernate project

2017-02-13 Thread THAN_HVFC
Hi all!
I am new to Struts2.  I downloaded Strust-2.5.8-all which bundled with Tiles.  
I created my web application with Strust-2.5.8 and Hibernate-5.1.  I deployed 
on Wildfly10 and the app ran fine.  
Now I decide to add JQuery to my project.  So I downloaded 
struts2-jquery-plugin-4.0.2 jar and put it inside my project lib folder and 
deployed on Wildfly10.  I got the error below.   As you can see the JQuery 
plugin breaks the Struts2 web app.  Please help!

16:14:15,945 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) 
MSC01: Failed to start service 
jboss.undertow.deployment.default-server.default-host./struts.UndertowDeploymentInfoService:
 org.jboss.msc.service.StartException in service 
jboss.undertow.deployment.default-server.default-host./struts.UndertowDeploymentInfoService:
 java.lang.ClassNotFoundException: 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter from 
[Module "deployment.struts.war:main" from Service Module Loader]        at 
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:1079)
        at 
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:284)
        at 
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
        at 
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
       at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
       at java.lang.Thread.run(Thread.java:745)Caused by: 
java.lang.ClassNotFoundException: 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter from 
[Module "deployment.struts.war:main" from Service Module Loader]        at 
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)       
 at 
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
        at 
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
        at 
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
        at 
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:801)
        ... 6 more


 Note:  If I take out the struts2-jquery-plugin-4.0.2 jar, the project works 
fine again without JQuery.  

My web.xml
http://java.sun.com/xml/ns/j2ee"         
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;>
    Struts Blank

   org.apache.struts2.tiles.StrutsTilesListener 

tilesDefinitions 
/WEB-INF/tiles.xml 
            struts2        
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
                  struts2   
     /*    

            index.jsp    

  Hi all!
I am new to Struts2.  I downloaded Strust-2.5.8-all which bundled with Tiles.  
I created my web application with Strust-2.5.8 and Hibernate-5.1.  I deployed 
on Wildfly10 and the app ran fine.  
Now I decide to add JQuery to my project.  So I downloaded 
struts2-jquery-plugin-4.0.2 jar and put it inside my project lib folder and 
deployed on Wildfly10.  I got the error below.   As you can see the JQuery 
plugin breaks the Struts2 web app.  Please help!

16:14:15,945 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) 
MSC01: Failed to start service 
jboss.undertow.deployment.default-server.default-host./struts.UndertowDeploymentInfoService:
 org.jboss.msc.service.StartException in service 
jboss.undertow.deployment.default-server.default-host./struts.UndertowDeploymentInfoService:
 java.lang.ClassNotFoundException: 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter from 
[Module "deployment.struts.war:main" from Service Module Loader]        at 
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:1079)
        at 
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:284)
        at 
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
        at 
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
       at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
       at java.lang.Thread.run(Thread.java:745)Caused by: 
java.lang.ClassNotFoundException: 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter from 
[Module &q

Re: struts2 json return null if involve hibernate or spring

2014-10-27 Thread Lukasz Lenart
2014-10-27 3:55 GMT+01:00 john lee sh_thorn_b...@yahoo.com.invalid:
  is hibernate dao manipulation could affect struts 2 json return?
 or spring framework could affect struts2 json return?
 my program's struts2 json execution is success if not involve dao or spring 
 call.
 but if involve hibernate/spring/dao manipulation, then json return is null 
 and not returned.
 struts.xmlpackage name=default extends=json-default ... action 
 name=cart-del class=CartAction method=del
 result name=json-data type=json/result

  /action
 /package
 Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
 loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
 defaultIndicator=myDefaultIndicator/

  %@ taglib prefix=s uri=/struts-tags %
  %@ taglib prefix=sj uri=/struts-jquery-tags% script 
 type=text/javascript
 function delItem(sn) {
 alert(here10, sn=+sn);
 $.post('cart-del.action', {partid: sn}, function(data) {
 alert(here20, data.deleted=+data.deleted);
 if (data.deleted) {
 alert(here30 - deleted);
 $('#tr_' + sn).remove();
 }   }
 else
 alert(here40 - not delete);
 });
 }
 /scipts:iterator value=#session.cartitems
tr id=tr_${j_part_id}
tdinput type=checkbox onclick=delItem('${j_part_id }') //td
td${part.pid}input type=hidden name=partids 
 value=${j_part_id} //td
/tr
 /s:iterator
 CartAction.java
   public class AcctAction extends ActionSupport {
  private String partid;
  private boolean deleted;
  public void setPartid(String partid) { this.partid=partid.trim(); }
  public String getPartid() { return partid; }
  public boolean getDeleted() { return deleted; } public String del() 
 throws Exception {
   /* problem is:
   if enable following business dao logic to delete item from 
 database, the item is deleted,
   and this is proved from querying database,
   but deleted variable always 'not delete in the Cart.jsp 
 alert statement.
   without business logic, then deleted can always return true;

   */
   /*
CartManagerImpl  cartmgr;
cartmgr.dao_delete...
   */

   deleted=true;
   return json-data;
  }
 }
 CartManagerImpl.javaimport org.apache.struts2.ServletActionContext;import 
 org.springframework.web.context.WebApplicationContext;
 import 
 org.springframework.web.context.support.WebApplicationContextUtils;public 
 class CartManagerImpl  {
 dao_delete 
 }

Maybe you have some exception here or some other problem when deleting
that item?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: struts2 json return null if involve hibernate or spring

2014-10-27 Thread john lee
the delete itself has no problem if called it directly. 
  From: Lukasz Lenart lukaszlen...@apache.org
 To: Struts Users Mailing List user@struts.apache.org 
 Sent: Monday, October 27, 2014 2:46 AM
 Subject: Re: struts2 json return null if involve hibernate or spring
   
2014-10-27 3:55 GMT+01:00 john lee sh_thorn_b...@yahoo.com.invalid:


  is hibernate dao manipulation could affect struts 2 json return?
 or spring framework could affect struts2 json return?
 my program's struts2 json execution is success if not involve dao or spring 
 call.
 but if involve hibernate/spring/dao manipulation, then json return is null 
 and not returned.
 struts.xmlpackage name=default extends=json-default    ...    action 
 name=cart-del class=CartAction method=del
                    result name=json-data type=json/result

      /action
 /package
 Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
 loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
 defaultIndicator=myDefaultIndicator/

  %@ taglib prefix=s uri=/struts-tags %
  %@ taglib prefix=sj uri=/struts-jquery-tags% script 
type=text/javascript
    function delItem(sn) {
                alert(here10, sn=+sn);
                $.post('cart-del.action', {partid: sn}, function(data) {
                        alert(here20, data.deleted=+data.deleted);
                        if (data.deleted) {
                                alert(here30 - deleted);
                                $('#tr_' + sn).remove();
                                }                              }
                        else
                                alert(here40 - not delete);
                });
        }
 /scipts:iterator value=#session.cartitems
    tr id=tr_${j_part_id}
        tdinput type=checkbox onclick=delItem('${j_part_id }') //td
        td${part.pid}input type=hidden name=partids 
value=${j_part_id} //td
    /tr
 /s:iterator
 CartAction.java
  public class AcctAction extends ActionSupport {
      private String partid;
      private boolean deleted;
      public void setPartid(String partid) { this.partid=partid.trim(); }
      public String getPartid() { return partid; }
      public boolean getDeleted() { return deleted; }    public String del() 
throws Exception {
              /* problem is:
                  if enable following business dao logic to delete item from 
database, the item is deleted,
                  and this is proved from querying database,
                  but deleted variable always 'not delete in the Cart.jsp 
alert statement.
                  without business logic, then deleted can always return true;

              */
              /*
                CartManagerImpl  cartmgr;
                cartmgr.dao_delete...
              */

              deleted=true;
              return json-data;
      }
 }
 CartManagerImpl.javaimport org.apache.struts2.ServletActionContext;import 
 org.springframework.web.context.WebApplicationContext;
 import 
 org.springframework.web.context.support.WebApplicationContextUtils;public 
 class CartManagerImpl  {
    dao_delete 
 }

Maybe you have some exception here or some other problem when deleting
that item?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


  

RE: [struts-user] Re: struts2 json return null if involve hibernate or spring

2014-10-27 Thread Jason Pyeron
 -Original Message-
 From: john lee 
 Sent: Monday, October 27, 2014 9:06
 
 the delete itself has no problem if called it directly. 

(please try not to top post)

   From: Lukasz Lenart lukaszlen...@apache.org
  To: Struts Users Mailing List user@struts.apache.org 
  Sent: Monday, October 27, 2014 2:46 AM
  Subject: Re: struts2 json return null if involve hibernate or spring

 2014-10-27 3:55 GMT+01:00 john lee sh_thorn_b...@yahoo.com.invalid:
 
 
   is hibernate dao manipulation could affect struts 2 json return?

In my expereince yes, regarding lazy loading and caching. But your code sample 
does not give enough detail to say if that is likely. What is the status of the 
Hibernate/JPA session at the time of the View rendering? 

  or spring framework could affect struts2 json return?
  my program's struts2 json execution is success if not 
 involve dao or spring call.
  but if involve hibernate/spring/dao manipulation, then json 
 return is null and not returned.
  struts.xmlpackage name=default extends=json-default   
  ...    action name=cart-del class=CartAction method=del
                     result name=json-data type=json/result
 
       /action
  /package
  Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
 loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
 defaultIndicator=myDefaultIndicator/
 
   %@ taglib prefix=s uri=/struts-tags %
   %@ taglib prefix=sj uri=/struts-jquery-tags% script 
 type=text/javascript
     function delItem(sn) {
                 alert(here10, sn=+sn);
                 $.post('cart-del.action', {partid: sn}, 
 function(data) {
                         alert(here20, data.deleted=+data.deleted);
                         if (data.deleted) {
                                 alert(here30 - deleted);
                                 $('#tr_' + sn).remove();
                                 }                              }
                         else
                                 alert(here40 - not delete);
                 });
         }
  /scipts:iterator value=#session.cartitems
     tr id=tr_${j_part_id}
         tdinput type=checkbox 
 onclick=delItem('${j_part_id }') //td
         td${part.pid}input type=hidden name=partids 
 value=${j_part_id} //td
     /tr
  /s:iterator
  CartAction.java
   public class AcctAction extends ActionSupport {
       private String partid;
       private boolean deleted;
       public void setPartid(String partid) { 
 this.partid=partid.trim(); }
       public String getPartid() { return partid; }
       public boolean getDeleted() { return deleted; }    
 public String del() throws Exception {
               /* problem is:
                   if enable following business dao logic to 
 delete item from database, the item is deleted,
                   and this is proved from querying database,
                   but deleted variable always 'not delete in 
 the Cart.jsp alert statement.
                   without business logic, then deleted can 
 always return true;
 
               */
               /*
                 CartManagerImpl  cartmgr;
                 cartmgr.dao_delete...

What is the Hibernate code here?

Do you have the same problems in your JSP Views?

               */
 
               deleted=true;
               return json-data;
       }
  }
  CartManagerImpl.javaimport 
 org.apache.struts2.ServletActionContext;import 
 org.springframework.web.context.WebApplicationContext;
  import 
 org.springframework.web.context.support.WebApplicationContextU
 tils;public class CartManagerImpl  {
     dao_delete 
  }
 
 Maybe you have some exception here or some other problem when deleting
 that item?

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-   -
- Jason Pyeron  PD Inc. http://www.pdinc.us -
- Principal Consultant  10 West 24th Street #100-
- +1 (443) 269-1555 x333Baltimore, Maryland 21218   -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00. 


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



Re: [struts-user] Re: struts2 json return null if involve hibernate or spring

2014-10-27 Thread john lee
What is the status of the Hibernate/JPA session at the time of the View 
rendering? 
i just use the following session approach       in the application.xml          
bean id=cartmgr class=CartManagerImpl scope=prototype                  
property name=cartDao ref=cartDao/          /bean
 in the CartManagerImpl.java  public class CartManagerImpl implements 
CartManager  {
    CartDao cartDao;    public void setCartDao(CartDao cartDao) { 
this.cartDao=cartDao; }           public void removeSingle(Cartitem item) 
throws Exception { cartDao.deleteSingle(item); }
  

  From: Jason Pyeron jpye...@pdinc.us
 To: 'Struts Users Mailing List' user@struts.apache.org 
 Sent: Monday, October 27, 2014 8:20 AM
 Subject: RE: [struts-user] Re: struts2 json return null if involve hibernate 
or spring
   
 -Original Message-
 From: john lee 
 Sent: Monday, October 27, 2014 9:06
 
 the delete itself has no problem if called it directly. 

(please try not to top post)

      From: Lukasz Lenart lukaszlen...@apache.org
  To: Struts Users Mailing List user@struts.apache.org 
  Sent: Monday, October 27, 2014 2:46 AM
  Subject: Re: struts2 json return null if involve hibernate or spring
    
 2014-10-27 3:55 GMT+01:00 john lee sh_thorn_b...@yahoo.com.invalid:
 
 
   is hibernate dao manipulation could affect struts 2 json return?

In my expereince yes, regarding lazy loading and caching. But your code sample 
does not give enough detail to say if that is likely. What is the status of the 
Hibernate/JPA session at the time of the View rendering? 

  or spring framework could affect struts2 json return?
  my program's struts2 json execution is success if not 
 involve dao or spring call.
  but if involve hibernate/spring/dao manipulation, then json 
 return is null and not returned.
  struts.xmlpackage name=default extends=json-default   
  ...    action name=cart-del class=CartAction method=del
                     result name=json-data type=json/result
 
       /action
  /package
  Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
 loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
 defaultIndicator=myDefaultIndicator/
 
   %@ taglib prefix=s uri=/struts-tags %
   %@ taglib prefix=sj uri=/struts-jquery-tags% script 
 type=text/javascript
     function delItem(sn) {
                 alert(here10, sn=+sn);
                 $.post('cart-del.action', {partid: sn}, 
 function(data) {
                         alert(here20, data.deleted=+data.deleted);
                         if (data.deleted) {
                                 alert(here30 - deleted);
                                 $('#tr_' + sn).remove();
                                 }                              }
                         else
                                 alert(here40 - not delete);
                 });
         }
  /scipts:iterator value=#session.cartitems
     tr id=tr_${j_part_id}
         tdinput type=checkbox 
 onclick=delItem('${j_part_id }') //td
         td${part.pid}input type=hidden name=partids 
 value=${j_part_id} //td
     /tr
  /s:iterator
  CartAction.java
   public class AcctAction extends ActionSupport {
       private String partid;
       private boolean deleted;
       public void setPartid(String partid) { 
 this.partid=partid.trim(); }
       public String getPartid() { return partid; }
       public boolean getDeleted() { return deleted; }    
 public String del() throws Exception {
               /* problem is:
                   if enable following business dao logic to 
 delete item from database, the item is deleted,
                   and this is proved from querying database,
                   but deleted variable always 'not delete in 
 the Cart.jsp alert statement.
                   without business logic, then deleted can 
 always return true;
 
               */
               /*
                 CartManagerImpl  cartmgr;
                 cartmgr.dao_delete...

What is the Hibernate code here?

Do you have the same problems in your JSP Views?

               */
 
               deleted=true;
               return json-data;
       }
  }
  CartManagerImpl.javaimport 
 org.apache.struts2.ServletActionContext;import 
 org.springframework.web.context.WebApplicationContext;
  import 
 org.springframework.web.context.support.WebApplicationContextU
 tils;public class CartManagerImpl  {
     dao_delete 
  }
 
 Maybe you have some exception here or some other problem when deleting
 that item?

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                              -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218  -
-                                                              -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00

struts2 json return null if involve hibernate or spring

2014-10-26 Thread john lee
 is hibernate dao manipulation could affect struts 2 json return?
or spring framework could affect struts2 json return?
my program's struts2 json execution is success if not involve dao or spring 
call.
but if involve hibernate/spring/dao manipulation, then json return is null and 
not returned.
struts.xmlpackage name=default extends=json-default ... action 
name=cart-del class=CartAction method=del
    result name=json-data type=json/result
    
 /action
/package
Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
defaultIndicator=myDefaultIndicator/
 
 %@ taglib prefix=s uri=/struts-tags %
 %@ taglib prefix=sj uri=/struts-jquery-tags% script 
type=text/javascript
    function delItem(sn) {
    alert(here10, sn=+sn);
    $.post('cart-del.action', {partid: sn}, function(data) {
    alert(here20, data.deleted=+data.deleted);
    if (data.deleted) {
    alert(here30 - deleted);
    $('#tr_' + sn).remove();
    }   }
    else
    alert(here40 - not delete);
    });
    }
/scipts:iterator value=#session.cartitems
   tr id=tr_${j_part_id}
   tdinput type=checkbox onclick=delItem('${j_part_id }') //td
   td${part.pid}input type=hidden name=partids value=${j_part_id} 
//td
   /tr
/s:iterator
CartAction.java
  public class AcctAction extends ActionSupport {
 private String partid;
 private boolean deleted;
 public void setPartid(String partid) { this.partid=partid.trim(); }
 public String getPartid() { return partid; }
 public boolean getDeleted() { return deleted; } public String del() 
throws Exception {
  /* problem is: 
  if enable following business dao logic to delete item from 
database, the item is deleted, 
  and this is proved from querying database, 
  but deleted variable always 'not delete in the Cart.jsp alert 
statement.
  without business logic, then deleted can always return true;  
   
    
  */
  /* 
   CartManagerImpl  cartmgr;
   cartmgr.dao_delete...
  */
   
  deleted=true;
  return json-data;
 }
}
CartManagerImpl.javaimport org.apache.struts2.ServletActionContext;import 
org.springframework.web.context.WebApplicationContext;
import 
org.springframework.web.context.support.WebApplicationContextUtils;public class 
CartManagerImpl  {
    dao_delete 
}


struts integrate with hibernate and spring

2014-10-20 Thread phoenix
I want to integrate struts2 with hibernate4 and spring4,but i don't know if  i 
need to use spring to manager struts action, is spring manager struts action 
better than struts manage action itself? Which method is better?  I am puzzled 
with how to integrate struts2 with hibernate4 and spring4, Anyone could give me 
whole code which i can learn and run struts2 with hibernate4 and spring4? 
Thanks.

Any example integrate struts2 ( CRUD without Hibernate, nor EJB, nor Glassfish)

2014-10-20 Thread Chris
Hello,

I would like to integrate struts2 in an CRUD application , JDBC, Apache Tomcat, 
Netbeans ( or eclipse ) 

but without Hibernate , nor EJB, nor GlassFish.
Hibernate is more complex than the problem it tries to solveCould you have any 
integration example 
please ?

Thanks,

Regards,

Chris


How to implement multi tenancy with separate database in struts and hibernate?

2014-07-08 Thread Kevin Peterson
Hi, 

We have an application wherein we want to keep separate database for each 
client. We want to achieve this using multi tenancy approach. A working example 
will be highly appreciated.

Thanks,
Kevin Peterson



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



Re: How to implement multi tenancy with separate database in struts and hibernate?

2014-07-08 Thread john feng
Oracle 12c should fit your needs. Unless you want to recreate this feature
by your self.


On Tue, Jul 8, 2014 at 5:36 AM, Kevin Peterson qh.res...@gmail.com wrote:

 Hi,

 We have an application wherein we want to keep separate database for each
 client. We want to achieve this using multi tenancy approach. A working
 example will be highly appreciated.

 Thanks,
 Kevin Peterson



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




Re: How to implement multi tenancy with separate database in struts and hibernate?

2014-07-08 Thread Néstor Boscán
If you want to recreate this feature yourself with different databases
you're going to have to map your entrypoint (initial URL) to your specific
client and from there to the specific database datasource. Once you have
the data source, associate it with the SessionFactory and everything will
work correctly from there.

Regards,

Néstor


On Tue, Jul 8, 2014 at 3:38 PM, john feng johngf...@gmail.com wrote:

 Oracle 12c should fit your needs. Unless you want to recreate this feature
 by your self.


 On Tue, Jul 8, 2014 at 5:36 AM, Kevin Peterson qh.res...@gmail.com
 wrote:

  Hi,
 
  We have an application wherein we want to keep separate database for each
  client. We want to achieve this using multi tenancy approach. A working
  example will be highly appreciated.
 
  Thanks,
  Kevin Peterson
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 



Re: Hibernate problem with OGNL

2013-03-27 Thread Lukasz Lenart
2013/3/26 Markus Demetz mar...@demetz.eu:
 Hi,

 I don't know if this is the right place to ask, but maybe there is anyone
 who has experienced the same problem.

 I'm using Struts2 (latest version), with Hibernate (latest version)
 My database models all have getId().

 I have situations, where the getId() method of my model class returns null
 when navigating through OGNL e.g. when
 calling s:property value=#user.gallery.id/.

Have you tried s:property value=user.gallery.id/ or s:property
value=%{user.gallery.id}/

 When I call getId() from the method in my action class (e.g. UserListAction
 iterating though users and calling user.getGallery().getId()), it returns
 the id as expected.
 If I do that first in my action class, then also my s:property.../ renders
 the id as expected; so I thought about a lazy loading issue... all my
 getId() methods are public, NOT final, and the Long id members are
 protected.

 I also tried to add a getMyId() method in the model which calls getId() from
 within the same class.
 getMyId() { return getId(); }

 This surprisingly works and outputs the correct id when calling s:property
 value=#user.gallery.myId/

You know, HHH uses all that magic with proxies, baytecode manipulation
and so ;-)


Regards
Ł

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



Re: Hibernate problem with OGNL

2013-03-27 Thread Markus Demetz

Hi,


I have situations, where the getId() method of my model class returns null
when navigating through OGNL e.g. when
calling s:property value=#user.gallery.id/.


Have you tried s:property value=user.gallery.id/ or s:property
value=%{user.gallery.id}/

No luck :-(
I also tried with JSTL now without success.
It's very strange, since sometimes it works and then it reappears again.
I'll ask at the hibernate forum.

Regards,
Markus

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



Re: Hibernate problem with OGNL

2013-03-27 Thread Steve Higham

On 27/03/2013 10:42, Markus Demetz wrote:

Hi,


I have situations, where the getId() method of my model class returns 
null

when navigating through OGNL e.g. when
calling s:property value=#user.gallery.id/.


Have you tried s:property value=user.gallery.id/ or s:property
value=%{user.gallery.id}/

No luck :-(
I also tried with JSTL now without success.
It's very strange, since sometimes it works and then it reappears again.
I'll ask at the hibernate forum.

Regards,
Markus

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


I've seen this behavior on newly created instances. Hibernate doesn't 
know the ID until the object is persisted to the DB. Hibernate tries to 
delay this as long as possible to minimise DB writes. You would have 
thought a request for the ID would force a DB write but Hibernate 
doesn't seem to implement this behavior. If you want the ID you need to 
force the DB write first.


Steve

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



Re: Hibernate problem with OGNL

2013-03-27 Thread Markus Demetz

Hi,

I think I've found the problem.
I had javassist 3.17.1 (latest) in my project but hibernate 4.2 ships 
with version 3.15.0

Now it seems to work!

Thank you, and sorry for misplacing my question here!

Regards,
Markus



Am 27.03.2013 17:23, schrieb Steve Higham:

On 27/03/2013 10:42, Markus Demetz wrote:

Hi,


I have situations, where the getId() method of my model class returns 
null

when navigating through OGNL e.g. when
calling s:property value=#user.gallery.id/.


Have you tried s:property value=user.gallery.id/ or s:property
value=%{user.gallery.id}/

No luck :-(
I also tried with JSTL now without success.
It's very strange, since sometimes it works and then it reappears again.
I'll ask at the hibernate forum.

Regards,
Markus

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


I've seen this behavior on newly created instances. Hibernate doesn't 
know the ID until the object is persisted to the DB. Hibernate tries 
to delay this as long as possible to minimise DB writes. You would 
have thought a request for the ID would force a DB write but Hibernate 
doesn't seem to implement this behavior. If you want the ID you need 
to force the DB write first.


Steve

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




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



Re: Hibernate problem with OGNL

2013-03-27 Thread Lukasz Lenart
2013/3/27 Markus Demetz mar...@demetz.eu:
 I think I've found the problem.
 I had javassist 3.17.1 (latest) in my project but hibernate 4.2 ships with
 version 3.15.0
 Now it seems to work!

Yeah... this version is buggy :P I have tried update Ognl 3 to it but
no luck ;-)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Hibernate problem with OGNL

2013-03-26 Thread Markus Demetz

Hi,

I don't know if this is the right place to ask, but maybe there is 
anyone who has experienced the same problem.


I'm using Struts2 (latest version), with Hibernate (latest version)
My database models all have getId().

I have situations, where the getId() method of my model class returns 
null when navigating through OGNL e.g. when

calling s:property value=#user.gallery.id/.

When I call getId() from the method in my action class (e.g. 
UserListAction iterating though users and calling 
user.getGallery().getId()), it returns the id as expected.
If I do that first in my action class, then also my s:property.../ 
renders the id as expected; so I thought about a lazy loading issue... 
all my getId() methods are public, NOT final, and the Long id members 
are protected.


I also tried to add a getMyId() method in the model which calls getId() 
from within the same class.

getMyId() { return getId(); }

This surprisingly works and outputs the correct id when calling 
s:property value=#user.gallery.myId/


Did anyone experience something simliar or has any suggestions?
OGNL 3.0.6, Hibernate 4.2, Struts 2.3.12

Thanks,
Markus





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



RE: (OT) Hibernate question

2013-01-04 Thread Martin Gainty

an hour long discussion with a developer yesterday who said you *could* hint 
Hibernate predicates
Our allotted teleconference time ran out before we could get into the exact 
details of how to hint a Hibernate query

The concern for a potential client is to make all his Hibernate queries run 
fasteras explain plan on the Database shows repeated FTS
(personally..I dont know how to make a hibernate query run faster without 
hinting)
Anyone?
Martin  
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.

  Date: Fri, 4 Jan 2013 18:37:06 +0200
 Subject: Re: (OT) Hibernate question
 From: dio...@gmail.com
 To: user@struts.apache.org
 
 Hi!
 
 It's not possible to add hints to Hibernate criteria queries/hql queries.
 But it's possible to add it if you use native query(but it's not your case,
 as I understand).
 
 BR,
 Dionis
 
 2013/1/4 Martin Gainty mgai...@hotmail.com
 
  oes anyone know how to hint a Hiber
  

(OT) Hibernate question

2013-01-03 Thread Martin Gainty

Gentlemen This has been asked many times but i havent found an answer

Does anyone know how to hint a Hibernate predicate with something like  select 
/*+ index(emp_alias ix_emp) */ ... from scott.emp emp_alias

Martin 
__ If computers were self-aware 
they would'nt need human beingsAuthor Unknown   
  

Re: Store Interceptor not working with field error (using Hibernate validation)

2012-12-24 Thread Lukasz Lenart
2012/12/22 cyanoboy marcox872...@libero.it:
  package name=myStrutsSite namespace=/ extends=hibernate-default

  result-types
  result-type name=tiles
 class=org.apache.struts2.views.tiles.TilesResult /
  /result-types

  interceptors
  interceptor name=SessionCheckInterceptor
 class=myStrutsSite.util.SessionCheckInterceptor/
  interceptor-stack name=mySessionValidationStack
  interceptor-ref name=defaultStackHibernate /
  interceptor-ref name=SessionCheckInterceptor /
  /interceptor-stack
  /interceptors

You're using a custom interceptor stack so maybe you setup it in wrong
order - I mean order of interceptors is important :-)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: Store Interceptor not working with field error (using Hibernate validation)

2012-12-22 Thread cyanoboy
?xml version=1.0 encoding=UTF-8 ?

!DOCTYPE struts PUBLIC
 -//Apache Software Foundation//DTD Struts Configuration 2.0//EN
 http://struts.apache.org/dtds/struts-2.0.dtd;

struts

 constant name=struts.devMode value=true /
 constant name=struts.enable.DynamicMethodInvocation value=false /
 constant name=struts.custom.i18n.resources 
value=struts-messages /


 package name=myStrutsSite namespace=/ extends=hibernate-default

 result-types
 result-type name=tiles 
class=org.apache.struts2.views.tiles.TilesResult /
 /result-types

 interceptors
 interceptor name=SessionCheckInterceptor 
class=myStrutsSite.util.SessionCheckInterceptor/
 interceptor-stack name=mySessionValidationStack
 interceptor-ref name=defaultStackHibernate /
 interceptor-ref name=SessionCheckInterceptor /
 /interceptor-stack
 /interceptors

 default-interceptor-ref name=mySessionValidationStack/

 global-results
 result name=sessionexpired type=redirectAction 
 param name=actionNameindex/param
 /result
 /global-results


 action name=login class=myStrutsSite.actions.LoginAction 
 result name=input type=tiles baseLayout/result
 result name=success type=tiles baseLayout/result
 result name=error type=tiles baseLayout/result
 /action

 action name=register 
class=myStrutsSite.actions.RegisterAction 
 result name=input type=tilesregistration/result
 result name=success type=tilesbaseLayout/result
 result name=error type=tilesregistration/result
 /action


 action name=logout class=myStrutsSite.actions.LogoutAction 
 result name=success type=tiles baseLayout/result
 /action


 action name=index class=myStrutsSite.actions.HomeAction 
 interceptor-ref name=defaultStackHibernate /
 result name=success type=tilesbaseLayout/result
 /action


 action name=showinsertform 
class=myStrutsSite.actions.ShowInsertFormAction 
 interceptor-ref name=mySessionValidationStack /
 interceptor-ref name=store
 param name=operationModeRETRIEVE/param
 /interceptor-ref
 result name=success type=tiles insert/result
 result name=error type=tiles baseLayout/result
 /action

 action name=insert class=myStrutsSite.actions.InsertAction 
 interceptor-ref name=mySessionValidationStack
 param name=fileUpload.allowedTypesimage/png/param
 /interceptor-ref
 interceptor-ref name=store
 param name=operationModeSTORE/param
 /interceptor-ref
 interceptor-ref name=defaultStack /
 result name=success type=tiles baseLayout/result
 result name=error type=redirectAction 
 param name=actionNameshowinsertform/param
 /result
 result name=input type=redirectAction 
 param name=actionNameshowinsertform/param
 /result
 /action


 action name=* 
 result name=success type=tiles {1}/result
 /action

 /package
/struts





Il 22/12/2012 04:53, mohan rao [via Struts] ha scritto:
 Can you share complete struts.xml complete configuration.



 On Fri, Dec 21, 2012 at 10:48 PM, cyanoboy [hidden email] 
 /user/SendEmail.jtp?type=nodenode=5711488i=0 wrote:

  I copied wrong. The right code is this:
 
  interceptors
  interceptor name=SessionCheckInterceptor
  class=util.SessionCheckInterceptor/
  interceptor-stack name=mySessionValidationStack
  interceptor-ref name=defaultStackHibernate /
  interceptor-ref name=SessionCheckInterceptor /
  /interceptor-stack
  /interceptors
 
  default-interceptor-ref name=mySessionValidationStack/
 
  action name=insert class=actions.InsertAction 
  interceptor-ref name=mySessionValidationStack
  image/png
  /interceptor-ref
  interceptor-ref name=store
  STORE
  /interceptor-ref
  interceptor-ref name=defaultStack /
  result name=success type=tiles baseLayout/result
  result name=error type=redirectAction 
  showinsertform
  /result
  result name=input type=redirectAction 
  showinsertform
  /result
  /action
 
  action name=showinsertform class=actions.ShowInsertFormAction 
  interceptor-ref name=mySessionValidationStack /
  interceptor-ref name=store
  RETRIEVE
  /interceptor-ref
  result name=success type=tiles insert/result
  result name=error type=tiles baseLayout/result
  /action
 
  So, where is the problem?
 
 
 
  --
  View this message in context:
  
 http://struts.1045723.n5.nabble.com/Store-Interceptor-not-working-with-field

Store Interceptor not working with field error (using Hibernate validation)

2012-12-21 Thread cyanoboy
I have a Jsp with some textfields, these are validate using Hibernate
validation annotation (@Valid or @NotNull in the action) except one (input
image file) that is validate with default Struts2 validation (using
ActionName-validation.xml). I want to redirect to another action when the
submitted form is invalid (when textfields are null), and I want to store
fields error.

I tried with this:

interceptors
interceptor name=SessionCheckInterceptor
class=util.SessionCheckInterceptor/
interceptor-stack name=mySessionValidationStack  
interceptor-ref name=defaultStackHibernate /
interceptor-ref name=SessionCheckInterceptor /
/interceptor-stack  
/interceptors 

default-interceptor-ref name=mySessionValidationStack/ 

action name=insert class=actions.InsertAction
interceptor-ref name=mySessionValidationStack
image/png
/interceptor-ref 
interceptor-ref name=store
STORE
/interceptor-ref
interceptor-ref name=defaultStack /
result name=success type=tiles baseLayout/result
result name=error type=redirectAction 
showinsertform
/result
result name=input type=redirectAction 
showinsertform
/result
/action

action name=showinsertform class=actions.ShowInsertFormAction  
interceptor-ref name=mySessionValidationStack /
interceptor-ref name=store
RETRIEVE
/interceptor-ref
result name=success type=tiles insert/result
result name=error type=tiles baseLayout/result
/action 

But when I sumbit the form, the redirect succeed without showing me fields
error messages. Maybe I'm setting wrong the interceptor? Using hibernate I
need to override something? If I try to set manually error messages in the
action (with addActionError), they works! Can it be that hibernate error
fields messages are not stored in the session?



--
View this message in context: 
http://struts.1045723.n5.nabble.com/Store-Interceptor-not-working-with-field-error-using-Hibernate-validation-tp5711481.html
Sent from the Struts - User mailing list archive at Nabble.com.

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



Re: Store Interceptor not working with field error (using Hibernate validation)

2012-12-21 Thread cyanoboy
I copied wrong. The right code is this:

interceptors
interceptor name=SessionCheckInterceptor
class=util.SessionCheckInterceptor/
interceptor-stack name=mySessionValidationStack  
interceptor-ref name=defaultStackHibernate /
interceptor-ref name=SessionCheckInterceptor /
/interceptor-stack  
/interceptors 

default-interceptor-ref name=mySessionValidationStack/ 

action name=insert class=actions.InsertAction
interceptor-ref name=mySessionValidationStack
image/png
/interceptor-ref 
interceptor-ref name=store
STORE
/interceptor-ref
interceptor-ref name=defaultStack /
result name=success type=tiles baseLayout/result
result name=error type=redirectAction 
showinsertform
/result
result name=input type=redirectAction 
showinsertform
/result
/action

action name=showinsertform class=actions.ShowInsertFormAction  
interceptor-ref name=mySessionValidationStack /
interceptor-ref name=store
RETRIEVE
/interceptor-ref
result name=success type=tiles insert/result
result name=error type=tiles baseLayout/result
/action 

So, where is the problem?



--
View this message in context: 
http://struts.1045723.n5.nabble.com/Store-Interceptor-not-working-with-field-error-using-Hibernate-validation-tp5711481p5711486.html
Sent from the Struts - User mailing list archive at Nabble.com.

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



struts2-fullhibernatecore-plugin-2.2.2-GA with struts2 and Hibernate

2012-09-14 Thread pirzada rashid
Hi,

I am using struts2-fullhibernatecore-plugin-2.2.2-GA in a demo strut2
project with Hibernate. I tried my best but can not make it work. I am
using all the latest jars.

*Am I missing something?*

Please help

*ERROR LOG*

2012-09-14 02:06:50 - [  INFO -
SessionTransactionInjectorInterceptor:41 ] -- Full Hibernate Plugin
Validation could not detect Hibernate Validator 3.x
2012-09-14 02:06:50 - [  INFO -
SessionTransactionInjectorInterceptor:46 ] -- Full Hibernate Plugin
Validation using Hibernate Validator 4.x

*Library in my project*

[image: enter image description here]

*When I access page than get error*

java.lang.NullPointerException

com.myapp.dao.CustomerDAOImpl.listCustomer(CustomerDAOImpl.java:26)
com.myapp.web.CustomerAction.listCustomer(CustomerAction.java:47)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)

com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)..

*My CustomerDAOImpl.java*

package com.myapp.dao;

import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
import com.myapp.model.Customer;
import org.hibernate.Session;
import org.hibernate.Transaction;

import java.util.List;

public class CustomerDAOImpl implements CustomerDAO {

@SessionTarget
Session session;

@TransactionTarget
Transaction transaction;

//add the customer
public void addCustomer(Customer customer) {
session.save(customer);
}

//return all the customers in list
public ListCustomer listCustomer() {
return session.createQuery(from Customer).list();
}
}

*EDITED 

 @SessionTarget
Session session;

@TransactionTarget
Transaction transaction;

Problem is in the above code when Session and Transaction is injected. I am
wondering that this might be problem of
struts2-fullhibernatecore-plugin-2.2.2-GA not supporting

hibernate-release-4.1.6.Final
hibernate-validator-4.3.0.Final

because plugin site
http://code.google.com/p/full-hibernate-plugin-for-struts2/ mentioned that
only supported versions are

*This plugin is compatible with Hibernate Validator 3.1.0 and 4.0.2 (since
2.2 version)*.

*Is that the problem. Have anyone used this plugin with above mentioned
versions?*

*One more question: Can we use this plugin in the production environment?*


Re: struts2-fullhibernatecore-plugin-2.2.2-GA with struts2 and Hibernate

2012-09-14 Thread Alejandro
You must initializate session attribute.

2012/9/14 pirzada rashid pirzada.ras...@gmail.com

 Hi,

 I am using struts2-fullhibernatecore-plugin-2.2.2-GA in a demo strut2
 project with Hibernate. I tried my best but can not make it work. I am
 using all the latest jars.

 *Am I missing something?*

 Please help

 *ERROR LOG*

 2012-09-14 02:06:50 - [  INFO -
 SessionTransactionInjectorInterceptor:41 ] -- Full Hibernate Plugin
 Validation could not detect Hibernate Validator 3.x
 2012-09-14 02:06:50 - [  INFO -
 SessionTransactionInjectorInterceptor:46 ] -- Full Hibernate Plugin
 Validation using Hibernate Validator 4.x

 *Library in my project*

 [image: enter image description here]

 *When I access page than get error*

 java.lang.NullPointerException

 com.myapp.dao.CustomerDAOImpl.listCustomer(CustomerDAOImpl.java:26)
 com.myapp.web.CustomerAction.listCustomer(CustomerAction.java:47)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)

 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)..

 *My CustomerDAOImpl.java*

 package com.myapp.dao;

 import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
 import
 com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
 import com.myapp.model.Customer;
 import org.hibernate.Session;
 import org.hibernate.Transaction;

 import java.util.List;

 public class CustomerDAOImpl implements CustomerDAO {

 @SessionTarget
 Session session;

 @TransactionTarget
 Transaction transaction;

 //add the customer
 public void addCustomer(Customer customer) {
 session.save(customer);
 }

 //return all the customers in list
 public ListCustomer listCustomer() {
 return session.createQuery(from Customer).list();
 }
 }

 *EDITED 

  @SessionTarget
 Session session;

 @TransactionTarget
 Transaction transaction;

 Problem is in the above code when Session and Transaction is injected. I am
 wondering that this might be problem of
 struts2-fullhibernatecore-plugin-2.2.2-GA not supporting

 hibernate-release-4.1.6.Final
 hibernate-validator-4.3.0.Final

 because plugin site
 http://code.google.com/p/full-hibernate-plugin-for-struts2/ mentioned that
 only supported versions are

 *This plugin is compatible with Hibernate Validator 3.1.0 and 4.0.2 (since
 2.2 version)*.

 *Is that the problem. Have anyone used this plugin with above mentioned
 versions?*

 *One more question: Can we use this plugin in the production environment?*



Re: struts2-fullhibernatecore-plugin-2.2.2-GA with struts2 and Hibernate

2012-09-14 Thread pirzada rashid
Thanks. How initialize session where it should auto inject? . Please give
me example.

On Fri, Sep 14, 2012 at 4:22 PM, Alejandro apar...@gmail.com wrote:

 You must initializate session attribute.

 2012/9/14 pirzada rashid pirzada.ras...@gmail.com

  Hi,
 
  I am using struts2-fullhibernatecore-plugin-2.2.2-GA in a demo strut2
  project with Hibernate. I tried my best but can not make it work. I am
  using all the latest jars.
 
  *Am I missing something?*
 
  Please help
 
  *ERROR LOG*
 
  2012-09-14 02:06:50 - [  INFO -
  SessionTransactionInjectorInterceptor:41 ] -- Full Hibernate Plugin
  Validation could not detect Hibernate Validator 3.x
  2012-09-14 02:06:50 - [  INFO -
  SessionTransactionInjectorInterceptor:46 ] -- Full Hibernate Plugin
  Validation using Hibernate Validator 4.x
 
  *Library in my project*
 
  [image: enter image description here]
 
  *When I access page than get error*
 
  java.lang.NullPointerException
 
  com.myapp.dao.CustomerDAOImpl.listCustomer(CustomerDAOImpl.java:26)
  com.myapp.web.CustomerAction.listCustomer(CustomerAction.java:47)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
 
 
 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)..
 
  *My CustomerDAOImpl.java*
 
  package com.myapp.dao;
 
  import
 com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
  import
  com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
  import com.myapp.model.Customer;
  import org.hibernate.Session;
  import org.hibernate.Transaction;
 
  import java.util.List;
 
  public class CustomerDAOImpl implements CustomerDAO {
 
  @SessionTarget
  Session session;
 
  @TransactionTarget
  Transaction transaction;
 
  //add the customer
  public void addCustomer(Customer customer) {
  session.save(customer);
  }
 
  //return all the customers in list
  public ListCustomer listCustomer() {
  return session.createQuery(from Customer).list();
  }
  }
 
  *EDITED 
 
   @SessionTarget
  Session session;
 
  @TransactionTarget
  Transaction transaction;
 
  Problem is in the above code when Session and Transaction is injected. I
 am
  wondering that this might be problem of
  struts2-fullhibernatecore-plugin-2.2.2-GA not supporting
 
  hibernate-release-4.1.6.Final
  hibernate-validator-4.3.0.Final
 
  because plugin site
  http://code.google.com/p/full-hibernate-plugin-for-struts2/ mentioned
 that
  only supported versions are
 
  *This plugin is compatible with Hibernate Validator 3.1.0 and 4.0.2
 (since
  2.2 version)*.
 
  *Is that the problem. Have anyone used this plugin with above mentioned
  versions?*
 
  *One more question: Can we use this plugin in the production
 environment?*
 



DAOImpl for hibernate got few general and specific questions

2012-09-14 Thread pirzada rashid
Hi,

I have CustomerDAOImpl where I am doing CRUD. Few questions.

*Q1 -* Should I declare Session at class level or each method level OR
declare at class level and initialize at each method level?

*Q2 -* When fetching data like in listCustomer, Should I
session.beginTransaction(); and than commit it? . I think on fetch,
transaction shouldn't apply but if I am not atleast
session.beginTransaction(); gives error saying need active transaction.

*Q3 -* I have read that session is expensive and should not close it till
application is running. Where should I close and open it if not using
Spring etc?

*Q4 -* I get *WARNING* Note:
C:\Struts2_HelloWorld\src\com\myapp\dao\CustomerDAOImpl.java uses unchecked
or unsafe operations. Why is that and how to fix this?

*if you answer most of my problems will be clear. Thanks*

*CustomerDAOImpl.java*

package com.myapp.dao;

import com.myapp.model.Customer;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import java.util.List;

public class CustomerDAOImpl implements CustomerDAO {

Session session = HibernateUtil.getFactory().getCurrentSession();
Transaction tx = null;

//add the customer
public void addCustomer(Customer customer) {
tx = session.beginTransaction();
try {
session.save(customer);
tx.commit();
} catch (HibernateException e) {
if (tx != null) tx.rollback();
e.printStackTrace();
}
}

//return all the customers in list
public ListCustomer listCustomer() {
tx = session.beginTransaction();
return session.createQuery(from Customer).list();
}
}

*HibernateUtil.java*

package com.myapp.dao;

import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

public class HibernateUtil {

private static SessionFactory factory = getSessionFactory();
private static ServiceRegistry serviceRegistry;

private static synchronized SessionFactory getSessionFactory()
throws HibernateException {
Configuration configuration = new Configuration().configure();
serviceRegistry = new
ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
return configuration.buildSessionFactory(serviceRegistry);
}

public static SessionFactory getFactory() {
return factory;
}


}


FW: cant list data with hibernate struts

2012-03-15 Thread Oussama Jlassi

all exist and in default package

 Date: Wed, 14 Mar 2012 19:55:15 -0400
 Subject: Re: cant list data with hibernate struts
 From: davelnew...@gmail.com
 To: user@struts.apache.org
 
 Do all those classes in your config exist? Are they really all in the
 default package?
 
 Dave
 
 On Wed, Mar 14, 2012 at 7:43 PM, Oussama Jlassi oussa...@live.fr wrote:
 
 
  i use struts1.3 hibernate4 in tomcat6 i want to list data after the form
  but when i run localhost:8080/strutsh i get
  Etat HTTP 500 -type Rapport d'exceptionmessagedescription Le serveur a
  rencontré une erreur interne () qui l'a empêché de satisfaire la
  requête.exceptionorg.apache.jasper.JasperException:
  java.lang.NullPointerException: Module 'null' not found.
 
   
  org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
 
   
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
 
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  cause mèrejava.lang.NullPointerException: Module 'null' not found.
 org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
 org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
 org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
 org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
 
   org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:173)
 org.apache.jsp.index_jsp._jspService(index_jsp.java:94)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 
   
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
 
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  note La trace complète de la cause mère de cette erreur est disponible
  dans les fichiers journaux de Apache Tomcat/6.0.35.Apache Tomcat/6.0.35
 
  index.jsp
 
  %@ page language=java pageEncoding=ISO-8859-1%%@ taglib uri=
  http://struts.apache.org/tags-html; prefix=html %%@ taglib uri=
  http://struts.apache.org/tags-logic; prefix=logic %%@ taglib uri=
  http://struts.apache.org/tags-bean; prefix=bean %
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html:htmlheadmeta http-equiv=Content-Type
  content=text/html; charset=UTF-8titleJSP Page/title
   /headbody   html:form action=/hibid :
  html:text name=HibForm property=id / brtt : html:text
  name=HibForm property=tt / br t  : html:text
  name=HibForm property=t / brhtml:submit /
   /html:form  br/
  logic:iterate name=list id=testpbean:write name=test
  property=id//p/logic:iterate/body/html:html
 
  HibAction.java
  import javax.servlet.http.HttpServletRequest;import
  javax.servlet.http.HttpServletResponse;import javax.servlet.ServletContext;
  import org.apache.struts.action.Action;import
  org.apache.struts.action.ActionForm;import
  org.apache.struts.action.ActionForward;import
  org.apache.struts.action.ActionMapping;import
  org.hibernate.SessionFactory;import org.hibernate.*;import
  org.hibernate.Session;import java.util.*;
  public class HibAction extends Action {
  private List list;
 public ActionForward execute(   ActionMapping mapping,
   ActionForm form,HttpServletRequest request,
HttpServletResponse response) throws Exception{
 HibForm formObj = (HibForm)form;
 /*Get the servlet context */ServletContext
  context = request.getSession().getServletContext();
 /*Retrieve Session Factory */   SessionFactory
  factory = (SessionFactory)
   context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
 /*Open Hibernate Session */ Session session
  =factory.openSession();try {
 test t = new test();
   t.setId(formObj.getId());   t.setT(formObj.getT());
t.setTt(formObj.getTt());
 session.beginTransaction();
  session.save(t);
 Query query=session.createQuery(SELECT t FROM test
  t);//ArrayList list=(ArrayList)query.list();
list=query.list();
   session.getTransaction().commit();
   //request.getSession().setAttribute(list,list);
   } catch(Exception e) {
   session.getTransaction().rollback(); }   /*Close session */
 session.close();
 return mapping.findForward(success);  }
  public List getList

Re: FW: cant list data with hibernate struts

2012-03-15 Thread Dave Newton
Not sure; can't really read your post. It looks like there's a parsing
error on the config.

On Thu, Mar 15, 2012 at 1:48 PM, Oussama Jlassi oussa...@live.fr wrote:


 all exist and in default package

  Date: Wed, 14 Mar 2012 19:55:15 -0400
  Subject: Re: cant list data with hibernate struts
  From: davelnew...@gmail.com
  To: user@struts.apache.org
 
  Do all those classes in your config exist? Are they really all in the
  default package?
 
  Dave
 
  On Wed, Mar 14, 2012 at 7:43 PM, Oussama Jlassi oussa...@live.fr
 wrote:
 
  
   i use struts1.3 hibernate4 in tomcat6 i want to list data after the
 form
   but when i run localhost:8080/strutsh i get
   Etat HTTP 500 -type Rapport d'exceptionmessagedescription Le serveur a
   rencontré une erreur interne () qui l'a empêché de satisfaire la
   requête.exceptionorg.apache.jasper.JasperException:
   java.lang.NullPointerException: Module 'null' not found.
  
  
  
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
  
  
  
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
  
  
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
  
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   cause mèrejava.lang.NullPointerException: Module 'null' not found.
  
  org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
  
  org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
  org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
  
  org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
  
  
  org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:173)
  org.apache.jsp.index_jsp._jspService(index_jsp.java:94)
  
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  
  
  
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
  
  
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
  
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   note La trace complète de la cause mère de cette erreur est disponible
   dans les fichiers journaux de Apache Tomcat/6.0.35.Apache Tomcat/6.0.35
  
   index.jsp
  
   %@ page language=java pageEncoding=ISO-8859-1%%@ taglib uri=
   http://struts.apache.org/tags-html; prefix=html %%@ taglib uri=
   http://struts.apache.org/tags-logic; prefix=logic %%@ taglib uri=
   http://struts.apache.org/tags-bean; prefix=bean %
   !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
   html:htmlheadmeta http-equiv=Content-Type
   content=text/html; charset=UTF-8titleJSP Page/title
/headbody   html:form action=/hibid :
   html:text name=HibForm property=id / brtt :
 html:text
   name=HibForm property=tt / br t  : html:text
   name=HibForm property=t / brhtml:submit /
/html:form  br/
   logic:iterate name=list id=testpbean:write name=test
   property=id//p/logic:iterate/body/html:html
  
   HibAction.java
   import javax.servlet.http.HttpServletRequest;import
   javax.servlet.http.HttpServletResponse;import
 javax.servlet.ServletContext;
   import org.apache.struts.action.Action;import
   org.apache.struts.action.ActionForm;import
   org.apache.struts.action.ActionForward;import
   org.apache.struts.action.ActionMapping;import
   org.hibernate.SessionFactory;import org.hibernate.*;import
   org.hibernate.Session;import java.util.*;
   public class HibAction extends Action {
   private List list;
  public ActionForward execute(   ActionMapping mapping,
ActionForm form,HttpServletRequest request,
 HttpServletResponse response) throws Exception{
  HibForm formObj = (HibForm)form;
  /*Get the servlet context */ServletContext
   context = request.getSession().getServletContext();
  /*Retrieve Session Factory */   SessionFactory
   factory = (SessionFactory)
context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
  /*Open Hibernate Session */ Session session
   =factory.openSession();try {
  test t = new test();
t.setId(formObj.getId());
 t.setT(formObj.getT());
 t.setTt(formObj.getTt());
  session.beginTransaction();
   session.save(t);
  Query query=session.createQuery(SELECT t FROM
 test
   t);//ArrayList list=(ArrayList)query.list();
 list=query.list();
session.getTransaction().commit();
//request.getSession().setAttribute(list,list

FW: cant list data with hibernate struts

2012-03-15 Thread Oussama Jlassi


when i send my question it become disorganized 
and how to solve error
 Date: Thu, 15 Mar 2012 14:02:35 -0400
 Subject: Re: FW: cant list data with hibernate struts
 From: davelnew...@gmail.com
 To: user@struts.apache.org
 
 Not sure; can't really read your post. It looks like there's a parsing
 error on the config.
 
 On Thu, Mar 15, 2012 at 1:48 PM, Oussama Jlassi oussa...@live.fr wrote:
 
 
  all exist and in default package
 
   Date: Wed, 14 Mar 2012 19:55:15 -0400
   Subject: Re: cant list data with hibernate struts
   From: davelnew...@gmail.com
   To: user@struts.apache.org
  
   Do all those classes in your config exist? Are they really all in the
   default package?
  
   Dave
  
   On Wed, Mar 14, 2012 at 7:43 PM, Oussama Jlassi oussa...@live.fr
  wrote:
  
   
i use struts1.3 hibernate4 in tomcat6 i want to list data after the
  form
but when i run localhost:8080/strutsh i get
Etat HTTP 500 -type Rapport d'exceptionmessagedescription Le serveur a
rencontré une erreur interne () qui l'a empêché de satisfaire la
requête.exceptionorg.apache.jasper.JasperException:
java.lang.NullPointerException: Module 'null' not found.
   
   
   
  org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
   
   
   
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
   
   
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
   
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
cause mèrejava.lang.NullPointerException: Module 'null' not found.
   
   org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
   
   org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
   org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
   
   org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
   
   
   org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:173)
   org.apache.jsp.index_jsp._jspService(index_jsp.java:94)
   
   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   
   
   
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
   
   
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
   
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note La trace complète de la cause mère de cette erreur est disponible
dans les fichiers journaux de Apache Tomcat/6.0.35.Apache Tomcat/6.0.35
   
index.jsp
   
%@ page language=java pageEncoding=ISO-8859-1%%@ taglib uri=
http://struts.apache.org/tags-html; prefix=html %%@ taglib uri=
http://struts.apache.org/tags-logic; prefix=logic %%@ taglib uri=
http://struts.apache.org/tags-bean; prefix=bean %
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html:htmlheadmeta http-equiv=Content-Type
content=text/html; charset=UTF-8titleJSP Page/title
 /headbody   html:form action=/hibid :
html:text name=HibForm property=id / brtt :
  html:text
name=HibForm property=tt / br t  : html:text
name=HibForm property=t / brhtml:submit /
 /html:form  br/
logic:iterate name=list id=testpbean:write name=test
property=id//p/logic:iterate/body/html:html
   
HibAction.java
import javax.servlet.http.HttpServletRequest;import
javax.servlet.http.HttpServletResponse;import
  javax.servlet.ServletContext;
import org.apache.struts.action.Action;import
org.apache.struts.action.ActionForm;import
org.apache.struts.action.ActionForward;import
org.apache.struts.action.ActionMapping;import
org.hibernate.SessionFactory;import org.hibernate.*;import
org.hibernate.Session;import java.util.*;
public class HibAction extends Action {
private List list;
   public ActionForward execute(   ActionMapping mapping,
 ActionForm form,HttpServletRequest request,
  HttpServletResponse response) throws Exception{
   HibForm formObj = (HibForm)form;
   /*Get the servlet context */ServletContext
context = request.getSession().getServletContext();
   /*Retrieve Session Factory */   SessionFactory
factory = (SessionFactory)
 context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
   /*Open Hibernate Session */ Session session
=factory.openSession();try {
   test t = new test();
 t.setId(formObj.getId());
  t.setT(formObj.getT());
  t.setTt(formObj.getTt

cant list data with hibernate struts

2012-03-14 Thread Oussama Jlassi

i use struts1.3 hibernate4 in tomcat6 i want to list data after the form but 
when i run localhost:8080/strutsh i get
Etat HTTP 500 -type Rapport d'exceptionmessagedescription Le serveur a 
rencontré une erreur interne () qui l'a empêché de satisfaire la 
requête.exceptionorg.apache.jasper.JasperException: 
java.lang.NullPointerException: Module 'null' not found.

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
cause mèrejava.lang.NullPointerException: Module 'null' not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)

org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:173)
org.apache.jsp.index_jsp._jspService(index_jsp.java:94)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note La trace complète de la cause mère de cette erreur est disponible dans les 
fichiers journaux de Apache Tomcat/6.0.35.Apache Tomcat/6.0.35

index.jsp

%@ page language=java pageEncoding=ISO-8859-1%%@ taglib 
uri=http://struts.apache.org/tags-html; prefix=html %%@ taglib 
uri=http://struts.apache.org/tags-logic; prefix=logic %%@ taglib 
uri=http://struts.apache.org/tags-bean; prefix=bean %
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html:htmlheadmeta http-equiv=Content-Type 
content=text/html; charset=UTF-8titleJSP Page/title/head   
 body   html:form action=/hibid : html:text 
name=HibForm property=id / brtt : html:text name=HibForm 
property=tt / br t  : html:text name=HibForm property=t 
/ brhtml:submit /  /html:form  br/
logic:iterate name=list id=testpbean:write name=test 
property=id//p/logic:iterate/body/html:html

HibAction.java
import javax.servlet.http.HttpServletRequest;import 
javax.servlet.http.HttpServletResponse;import javax.servlet.ServletContext;
import org.apache.struts.action.Action;import 
org.apache.struts.action.ActionForm;import 
org.apache.struts.action.ActionForward;import 
org.apache.struts.action.ActionMapping;import 
org.hibernate.SessionFactory;import org.hibernate.*;import 
org.hibernate.Session;import java.util.*;
public class HibAction extends Action {
private List list;
public ActionForward execute(   ActionMapping mapping,  
ActionForm form,HttpServletRequest request, 
HttpServletResponse response) throws Exception{
HibForm formObj = (HibForm)form;
/*Get the servlet context */ServletContext context 
= request.getSession().getServletContext();
/*Retrieve Session Factory */   SessionFactory factory 
= (SessionFactory)
context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
/*Open Hibernate Session */ Session session 
=factory.openSession();try {  
test t = new test();
t.setId(formObj.getId());   t.setT(formObj.getT()); 
t.setTt(formObj.getTt());
session.beginTransaction(); 
session.save(t);
Query query=session.createQuery(SELECT t FROM test 
t);//ArrayList list=(ArrayList)query.list();   
  list=query.list();
session.getTransaction().commit();
//request.getSession().setAttribute(list,list);
 } catch(Exception e) {session.getTransaction().rollback(); }   
/*Close session */  session.close();
return mapping.findForward(success);  } 
public List getList() { return list;}public void setList(List list) 
{   this.list = list;   }
}
struts-config.xml
?xml version=1.0 encoding=ISO-8859-1 ?!DOCTYPE struts-config PUBLIC  
-//Apache Software Foundation//DTD Struts Configuration 1.3//EN  
http

Re: cant list data with hibernate struts

2012-03-14 Thread Dave Newton
Do all those classes in your config exist? Are they really all in the
default package?

Dave

On Wed, Mar 14, 2012 at 7:43 PM, Oussama Jlassi oussa...@live.fr wrote:


 i use struts1.3 hibernate4 in tomcat6 i want to list data after the form
 but when i run localhost:8080/strutsh i get
 Etat HTTP 500 -type Rapport d'exceptionmessagedescription Le serveur a
 rencontré une erreur interne () qui l'a empêché de satisfaire la
 requête.exceptionorg.apache.jasper.JasperException:
 java.lang.NullPointerException: Module 'null' not found.

  
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)

  
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)

  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 cause mèrejava.lang.NullPointerException: Module 'null' not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)

  org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:173)
org.apache.jsp.index_jsp._jspService(index_jsp.java:94)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

  
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)

  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 note La trace complète de la cause mère de cette erreur est disponible
 dans les fichiers journaux de Apache Tomcat/6.0.35.Apache Tomcat/6.0.35

 index.jsp

 %@ page language=java pageEncoding=ISO-8859-1%%@ taglib uri=
 http://struts.apache.org/tags-html; prefix=html %%@ taglib uri=
 http://struts.apache.org/tags-logic; prefix=logic %%@ taglib uri=
 http://struts.apache.org/tags-bean; prefix=bean %
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html:htmlheadmeta http-equiv=Content-Type
 content=text/html; charset=UTF-8titleJSP Page/title
  /headbody   html:form action=/hibid :
 html:text name=HibForm property=id / brtt : html:text
 name=HibForm property=tt / br t  : html:text
 name=HibForm property=t / brhtml:submit /
  /html:form  br/
 logic:iterate name=list id=testpbean:write name=test
 property=id//p/logic:iterate/body/html:html

 HibAction.java
 import javax.servlet.http.HttpServletRequest;import
 javax.servlet.http.HttpServletResponse;import javax.servlet.ServletContext;
 import org.apache.struts.action.Action;import
 org.apache.struts.action.ActionForm;import
 org.apache.struts.action.ActionForward;import
 org.apache.struts.action.ActionMapping;import
 org.hibernate.SessionFactory;import org.hibernate.*;import
 org.hibernate.Session;import java.util.*;
 public class HibAction extends Action {
 private List list;
public ActionForward execute(   ActionMapping mapping,
  ActionForm form,HttpServletRequest request,
   HttpServletResponse response) throws Exception{
HibForm formObj = (HibForm)form;
/*Get the servlet context */ServletContext
 context = request.getSession().getServletContext();
/*Retrieve Session Factory */   SessionFactory
 factory = (SessionFactory)
  context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
/*Open Hibernate Session */ Session session
 =factory.openSession();try {
test t = new test();
  t.setId(formObj.getId());   t.setT(formObj.getT());
   t.setTt(formObj.getTt());
session.beginTransaction();
 session.save(t);
Query query=session.createQuery(SELECT t FROM test
 t);//ArrayList list=(ArrayList)query.list();
   list=query.list();
  session.getTransaction().commit();
  //request.getSession().setAttribute(list,list);
  } catch(Exception e) {
  session.getTransaction().rollback(); }   /*Close session */
session.close();
return mapping.findForward(success);  }
 public List getList() { return list;}public void setList(List
 list) {   this.list = list;   }
 }
 struts-config.xml
 ?xml version=1.0 encoding=ISO-8859-1 ?!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.3//EN
  http

Re: Struts2-json-plugin serialization issue with a Hibernate backed JPA entity

2011-09-07 Thread Maurizio Cucchiara
You might take a look at [1], particoularly the section called root
object.
That's because I'm afraid that json plugin is trying to serialize your EJB
service.
HTH

[1] struts.apache.org/2.2.3/docs/json-plugin.html

Maurizio Cucchiara

Il giorno 07/set/2011 07.43, Ken McWilliams ken.mcwilli...@gmail.com ha
scritto:
 I have a JPA entity, which hibernate is proxying.

 The following action works as it explicitly states the properties to
 include, however what I would much rather do is use excludeProperties to
 remove the problematic property. The problem property when serialized
 causes a Positioned Update not supported exception.

 The interesting thing is, all the properties on the entity class are
 persisted correctly if explicitly included.

 Looking in the the debugger shows there is a property called
 $JAVASSIST_READ_WRITE_HANDLER of type FieldInterceptorImpl which
 Hibernate/JPA adds to the entity. I'm pretty sure this is what is
 causing it to fail.


 I've tried the following:
 @Action(value = list-clients, results = {
 @Result(type = json, params = {
 excludeProperties,
 list\\[.*\\]\\.\\$JAVASSIST_READ_WRITE_HANDLER.*
 })
 })

 but with no luck. Following is my action and the entity class.



 Here is my action (In a _working_ state):
 /
 @ParentPackage(json-default)
 @Result(type = json)
 public class ListTable extends ActionSupport {

 @EJB
 private ClientService clientService;
 private List list;

 @Action(value = list-clients, results = {
 @Result(type = json, params = {
 includeProperties,
 list\\[.*\\]\\.name, list\\[.*\\]\\.id, list\\[.*\\]\
 \.timelogCollection\\..*
 })
 })
 public String listClients() {
 list = clientService.list();
 return SUCCESS;
 }

 public List getList() {
 return list;
 }
 }
 /

 Here is the entity:
 /
 @Entity
 @Table(name = client)
 @XmlRootElement
 @NamedQueries({
 @NamedQuery(name = Client.findAll, query = SELECT c FROM Client
 c),
 @NamedQuery(name = Client.findById, query = SELECT c FROM Client
 c WHERE c.id = :id),
 @NamedQuery(name = Client.findByName, query = SELECT c FROM
 Client c WHERE c.name = :name)})
 public class Client implements Serializable {
 private static final long serialVersionUID = 1L;
 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 @Basic(optional = false)
 @NotNull
 @Column(name = id)
 private Integer id;
 @Size(max = 45)
 @Column(name = name)
 private String name;
 @OneToMany(cascade = CascadeType.ALL, mappedBy = clientId)
 private CollectionTimelog timelogCollection;

 public Client() {
 }

 public Client(Integer id) {
 this.id = id;
 }

 public Integer getId() {
 return id;
 }

 public void setId(Integer id) {
 this.id = id;
 }

 public String getName() {
 return name;
 }

 public void setName(String name) {
 this.name = name;
 }

 @XmlTransient
 public CollectionTimelog getTimelogCollection() {
 return timelogCollection;
 }

 public void setTimelogCollection(CollectionTimelog
 timelogCollection) {
 this.timelogCollection = timelogCollection;
 }

 @Override
 public int hashCode() {
 int hash = 0;
 hash += (id != null ? id.hashCode() : 0);
 return hash;
 }

 @Override
 public boolean equals(Object object) {
 // TODO: Warning - this method won't work in the case the id
 fields are not set
 if (!(object instanceof Client)) {
 return false;
 }
 Client other = (Client) object;
 if ((this.id == null  other.id != null) || (this.id != null
  !this.id.equals(other.id))) {
 return false;
 }
 return true;
 }

 @Override
 public String toString() {
 return com.aerose.kentimekeeper.db.Client[ id= + id +  ];
 }

 }
 /


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



Re: Struts2-json-plugin serialization issue with a Hibernate backed JPA entity

2011-09-07 Thread Ken McWilliams
Solved! I've seen a number of posts relating to this issue but none with
solutions...

In searching for how $JAVASSIST_READ_WRITE_HANDLER came into existence
we find:
http://www.docjar.com/html/api/org/hibernate/tool/instrument/javassist/FieldTransformer.java.html


There we can see the getter for $JAVASSIST_READ_WRITE_HANDLER is
actually getFieldHandler so the exclude parameter becomes:

@Action(value = list-clients, results = {
@Result(type = json, params = {
excludeProperties,
^list\\[.*\\]\\.fieldHandler\\..*
})
})

And it all works... 

Just tested the shorter .*\\.fieldHandler\\..* and it works too, which
is much better because now there is one solution for all such
instrumented entities!  
 
On Tue, 2011-09-06 at 22:20 -0600, Ken McWilliams wrote:
 I have a JPA entity, which hibernate is proxying.  
 
 The following action works as it explicitly states the properties to
 include, however what I would much rather do is use excludeProperties to
 remove the problematic property. The problem property when serialized
 causes a Positioned Update not supported exception.
 
 The interesting thing is, all the properties on the entity class are
 persisted correctly if explicitly included.
 
 Looking in the  the debugger shows there is a property called
 $JAVASSIST_READ_WRITE_HANDLER of type FieldInterceptorImpl which
 Hibernate/JPA adds to the entity. I'm pretty sure this is what is
 causing it to fail.
 
 
 I've tried the following: 
 @Action(value = list-clients, results = {
 @Result(type = json, params = {
 excludeProperties,
 list\\[.*\\]\\.\\$JAVASSIST_READ_WRITE_HANDLER.*
 })
 })
 
 but with no luck.  Following is my action and the entity class.
 
  
 
 Here is my action (In a _working_ state):
 /
 @ParentPackage(json-default)
 @Result(type = json)
 public class ListTable extends ActionSupport {
 
 @EJB
 private ClientService clientService;
 private List list;
 
 @Action(value = list-clients, results = {
 @Result(type = json, params = {
 includeProperties,
 list\\[.*\\]\\.name, list\\[.*\\]\\.id, list\\[.*\\]\
 \.timelogCollection\\..* 
 })
 })
 public String listClients() {
 list = clientService.list();
 return SUCCESS;
 }
 
 public List getList() {
 return list;
 }
 }
 /
 
 Here is the entity:
 /
 @Entity
 @Table(name = client)
 @XmlRootElement
 @NamedQueries({
 @NamedQuery(name = Client.findAll, query = SELECT c FROM Client
 c),
 @NamedQuery(name = Client.findById, query = SELECT c FROM Client
 c WHERE c.id = :id),
 @NamedQuery(name = Client.findByName, query = SELECT c FROM
 Client c WHERE c.name = :name)})
 public class Client implements Serializable {
 private static final long serialVersionUID = 1L;
 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 @Basic(optional = false)
 @NotNull
 @Column(name = id)
 private Integer id;
 @Size(max = 45)
 @Column(name = name)
 private String name;
 @OneToMany(cascade = CascadeType.ALL, mappedBy = clientId)
 private CollectionTimelog timelogCollection;
 
 public Client() {
 }
 
 public Client(Integer id) {
 this.id = id;
 }
 
 public Integer getId() {
 return id;
 }
 
 public void setId(Integer id) {
 this.id = id;
 }
 
 public String getName() {
 return name;
 }
 
 public void setName(String name) {
 this.name = name;
 }
 
 @XmlTransient
 public CollectionTimelog getTimelogCollection() {
 return timelogCollection;
 }
 
 public void setTimelogCollection(CollectionTimelog
 timelogCollection) {
 this.timelogCollection = timelogCollection;
 }
 
 @Override
 public int hashCode() {
 int hash = 0;
 hash += (id != null ? id.hashCode() : 0);
 return hash;
 }
 
 @Override
 public boolean equals(Object object) {
 // TODO: Warning - this method won't work in the case the id
 fields are not set
 if (!(object instanceof Client)) {
 return false;
 }
 Client other = (Client) object;
 if ((this.id == null  other.id != null) || (this.id != null
  !this.id.equals(other.id))) {
 return false;
 }
 return true;
 }
 
 @Override
 public String toString() {
 return com.aerose.kentimekeeper.db.Client[ id= + id +  ];
 }
 
 }
 /
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 




-
To unsubscribe, e-mail: user-unsubscr

Re: Struts2-json-plugin serialization issue with a Hibernate backed JPA entity

2011-09-07 Thread Ken McWilliams
I need the root object to be list so this isn't going to help.

I'm pretty sure it is not trying to serialize the EJB service, the json
plugin will only try to serialize properties which have getters. 

According the debugger there seems to be a public property directly in
the entity called $JAVASSIST_READ_WRITE_HANDLER, I'm quite confident
that is in the attempt to serialize this object the issue occurs.

To be extra sure I set list as the root and the issue still occurs. 

On Wed, 2011-09-07 at 07:59 +0200, Maurizio Cucchiara wrote:
 You might take a look at [1], particoularly the section called root
 object.
 That's because I'm afraid that json plugin is trying to serialize your EJB
 service.
 HTH
 
 [1] struts.apache.org/2.2.3/docs/json-plugin.html
 
 Maurizio Cucchiara
 
 Il giorno 07/set/2011 07.43, Ken McWilliams ken.mcwilli...@gmail.com ha
 scritto:
  I have a JPA entity, which hibernate is proxying.
 
  The following action works as it explicitly states the properties to
  include, however what I would much rather do is use excludeProperties to
  remove the problematic property. The problem property when serialized
  causes a Positioned Update not supported exception.
 
  The interesting thing is, all the properties on the entity class are
  persisted correctly if explicitly included.
 
  Looking in the the debugger shows there is a property called
  $JAVASSIST_READ_WRITE_HANDLER of type FieldInterceptorImpl which
  Hibernate/JPA adds to the entity. I'm pretty sure this is what is
  causing it to fail.
 
 
  I've tried the following:
  @Action(value = list-clients, results = {
  @Result(type = json, params = {
  excludeProperties,
  list\\[.*\\]\\.\\$JAVASSIST_READ_WRITE_HANDLER.*
  })
  })
 
  but with no luck. Following is my action and the entity class.
 
 
 
  Here is my action (In a _working_ state):
  /
  @ParentPackage(json-default)
  @Result(type = json)
  public class ListTable extends ActionSupport {
 
  @EJB
  private ClientService clientService;
  private List list;
 
  @Action(value = list-clients, results = {
  @Result(type = json, params = {
  includeProperties,
  list\\[.*\\]\\.name, list\\[.*\\]\\.id, list\\[.*\\]\
  \.timelogCollection\\..*
  })
  })
  public String listClients() {
  list = clientService.list();
  return SUCCESS;
  }
 
  public List getList() {
  return list;
  }
  }
  /
 
  Here is the entity:
  /
  @Entity
  @Table(name = client)
  @XmlRootElement
  @NamedQueries({
  @NamedQuery(name = Client.findAll, query = SELECT c FROM Client
  c),
  @NamedQuery(name = Client.findById, query = SELECT c FROM Client
  c WHERE c.id = :id),
  @NamedQuery(name = Client.findByName, query = SELECT c FROM
  Client c WHERE c.name = :name)})
  public class Client implements Serializable {
  private static final long serialVersionUID = 1L;
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Basic(optional = false)
  @NotNull
  @Column(name = id)
  private Integer id;
  @Size(max = 45)
  @Column(name = name)
  private String name;
  @OneToMany(cascade = CascadeType.ALL, mappedBy = clientId)
  private CollectionTimelog timelogCollection;
 
  public Client() {
  }
 
  public Client(Integer id) {
  this.id = id;
  }
 
  public Integer getId() {
  return id;
  }
 
  public void setId(Integer id) {
  this.id = id;
  }
 
  public String getName() {
  return name;
  }
 
  public void setName(String name) {
  this.name = name;
  }
 
  @XmlTransient
  public CollectionTimelog getTimelogCollection() {
  return timelogCollection;
  }
 
  public void setTimelogCollection(CollectionTimelog
  timelogCollection) {
  this.timelogCollection = timelogCollection;
  }
 
  @Override
  public int hashCode() {
  int hash = 0;
  hash += (id != null ? id.hashCode() : 0);
  return hash;
  }
 
  @Override
  public boolean equals(Object object) {
  // TODO: Warning - this method won't work in the case the id
  fields are not set
  if (!(object instanceof Client)) {
  return false;
  }
  Client other = (Client) object;
  if ((this.id == null  other.id != null) || (this.id != null
   !this.id.equals(other.id))) {
  return false;
  }
  return true;
  }
 
  @Override
  public String toString() {
  return com.aerose.kentimekeeper.db.Client[ id= + id +  ];
  }
 
  }
  /
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 




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



Struts2-json-plugin serialization issue with a Hibernate backed JPA entity

2011-09-06 Thread Ken McWilliams
I have a JPA entity, which hibernate is proxying.  

The following action works as it explicitly states the properties to
include, however what I would much rather do is use excludeProperties to
remove the problematic property. The problem property when serialized
causes a Positioned Update not supported exception.

The interesting thing is, all the properties on the entity class are
persisted correctly if explicitly included.

Looking in the  the debugger shows there is a property called
$JAVASSIST_READ_WRITE_HANDLER of type FieldInterceptorImpl which
Hibernate/JPA adds to the entity. I'm pretty sure this is what is
causing it to fail.


I've tried the following: 
@Action(value = list-clients, results = {
@Result(type = json, params = {
excludeProperties,
list\\[.*\\]\\.\\$JAVASSIST_READ_WRITE_HANDLER.*
})
})

but with no luck.  Following is my action and the entity class.

 

Here is my action (In a _working_ state):
/
@ParentPackage(json-default)
@Result(type = json)
public class ListTable extends ActionSupport {

@EJB
private ClientService clientService;
private List list;

@Action(value = list-clients, results = {
@Result(type = json, params = {
includeProperties,
list\\[.*\\]\\.name, list\\[.*\\]\\.id, list\\[.*\\]\
\.timelogCollection\\..* 
})
})
public String listClients() {
list = clientService.list();
return SUCCESS;
}

public List getList() {
return list;
}
}
/

Here is the entity:
/
@Entity
@Table(name = client)
@XmlRootElement
@NamedQueries({
@NamedQuery(name = Client.findAll, query = SELECT c FROM Client
c),
@NamedQuery(name = Client.findById, query = SELECT c FROM Client
c WHERE c.id = :id),
@NamedQuery(name = Client.findByName, query = SELECT c FROM
Client c WHERE c.name = :name)})
public class Client implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@NotNull
@Column(name = id)
private Integer id;
@Size(max = 45)
@Column(name = name)
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = clientId)
private CollectionTimelog timelogCollection;

public Client() {
}

public Client(Integer id) {
this.id = id;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@XmlTransient
public CollectionTimelog getTimelogCollection() {
return timelogCollection;
}

public void setTimelogCollection(CollectionTimelog
timelogCollection) {
this.timelogCollection = timelogCollection;
}

@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}

@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id
fields are not set
if (!(object instanceof Client)) {
return false;
}
Client other = (Client) object;
if ((this.id == null  other.id != null) || (this.id != null
 !this.id.equals(other.id))) {
return false;
}
return true;
}

@Override
public String toString() {
return com.aerose.kentimekeeper.db.Client[ id= + id +  ];
}

}
/


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



Re: How to implement EJB 3.0, JPA, Hibernate and Struts 2 in one application?

2011-08-15 Thread Maurizio Cucchiara
I think this is a good starting point: http://s.apache.org/jpa
Maurizio Cucchiara



On 15 August 2011 07:05, Coolemma coolemma2...@gmail.com wrote:
 EJB 3.0, JPA, Hibernate and Struts 2

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



RE: How to implement EJB 3.0, JPA, Hibernate and Struts 2 in one application?

2011-08-15 Thread Marcus Bond
Have never tried this out with ejb since it isn't isn't my thing but just
the same as a spring / struts (or any other framework) app your service
layer would be called from your struts actions such that struts isn't likely
to know about or care about the fact that the service  classes are ejb,
spring beans or anything.

Sooo.. each technology you mention has different purposes in your app and
should work together fine, Struts will provide your controllers and  the
actions will reference an ejb service layer with some ejbs using JPA via an
injected entity manager for which the underlying implementation for JPA
would be hibernate.. job done.

In answer to your second question, afaik Seam may be worth a look if you're
after ejb webapps..

 Marcus

-Original Message-
From: maurizio.cucchi...@gmail.com [mailto:maurizio.cucchi...@gmail.com] On
Behalf Of Maurizio Cucchiara
Sent: 15 August 2011 10:28
To: Struts Users Mailing List
Subject: Re: How to implement EJB 3.0, JPA, Hibernate and Struts 2 in one
application?

I think this is a good starting point: http://s.apache.org/jpa Maurizio
Cucchiara



On 15 August 2011 07:05, Coolemma coolemma2...@gmail.com wrote:
 EJB 3.0, JPA, Hibernate and Struts 2

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



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



struts2 hibernate

2011-05-15 Thread Saeed Najahi
hello guys, plz i need some help concerning struts 2.2.3 and hibernate
3.6.3,
the problem i'm having is that the jars seem to keep fighting with each
other :( exceptions that stop me from even daring to write a single line of
code that implicates hibernate and struts, the documentation doesn't help
much unfortunatly, explanation or indication of what version of what jar is
needed isn't mentioned, i've never even thought that javassist was needed
untill i downloaded a struts project from google code, there was no
mentioning of it whatsoever in the tutorial
would anyone kindly give me a pom.xml of a working struts2 and hibernate
project (in addition to the full hibernate plugin), please help me out i'm
pretty much depressed right now,
thanks in advance guys

-- 

`*The early bird catches the worm, but the second mouse gets the cheese..*`

*NAJAHI Saïd* (* KyouJin-SaMa* )
4ème année G.Info E.N.S.A.Safi
-


Re: struts2 hibernate

2011-05-15 Thread Dave Newton
On Sun, May 15, 2011 at 6:46 PM, Saeed Najahi najah...@gmail.com wrote:
 code that implicates hibernate and struts, the documentation doesn't help
 much unfortunatly, explanation or indication of what version of what jar is
 needed isn't mentioned,

Dependencies should be managed by Maven (or similar), not by
hand--anything but the *most* basic S2 application (in other words, no
plugins, pretty much no anything) ups the library requirements pretty
quickly.

In any case, did you look at the S2 blank app included in the main
distro? Often times looking at the artifacts included in a download
provide clues regarding library usage. The blank app includes the
following libraries:

WEB-INF/lib/asm-3.1.jar
WEB-INF/lib/asm-commons-3.1.jar
WEB-INF/lib/asm-tree-3.1.jar
WEB-INF/lib/commons-fileupload-1.2.2.jar
WEB-INF/lib/commons-io-2.0.1.jar
WEB-INF/lib/commons-lang-2.5.jar
WEB-INF/lib/freemarker-2.3.16.jar
WEB-INF/lib/javassist-3.11.0.GA.jar
WEB-INF/lib/ognl-3.0.1.jar
WEB-INF/lib/struts2-core-2.2.3.jar
WEB-INF/lib/xwork-core-2.2.3.jar

 (in addition to the full hibernate plugin)

There is no Hibernate plugin.

Since you don't provide any information regarding the errors you're
getting, it's difficult to help much more than that.

Dave

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



RE: struts2 hibernate

2011-05-15 Thread Jason Pyeron

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com] 
 Sent: Sunday, May 15, 2011 19:31
 To: Struts Users Mailing List
 Subject: Re: struts2  hibernate
 
 On Sun, May 15, 2011 at 6:46 PM, Saeed Najahi 
 najah...@gmail.com wrote:
  code that implicates hibernate and struts, the 
 documentation doesn't 
  help much unfortunatly, explanation or indication of what 
 version of 
  what jar is needed isn't mentioned,
 
 Dependencies should be managed by Maven (or similar), not by 
 hand--anything but the *most* basic S2 application (in other 
 words, no plugins, pretty much no anything) ups the library 
 requirements pretty quickly.
 
 In any case, did you look at the S2 blank app included in 
 the main distro? Often times looking at the artifacts 
 included in a download provide clues regarding library usage. 
 The blank app includes the following libraries:
 
 WEB-INF/lib/asm-3.1.jar
 WEB-INF/lib/asm-commons-3.1.jar
 WEB-INF/lib/asm-tree-3.1.jar
 WEB-INF/lib/commons-fileupload-1.2.2.jar
 WEB-INF/lib/commons-io-2.0.1.jar
 WEB-INF/lib/commons-lang-2.5.jar
 WEB-INF/lib/freemarker-2.3.16.jar
 WEB-INF/lib/javassist-3.11.0.GA.jar
 WEB-INF/lib/ognl-3.0.1.jar
 WEB-INF/lib/struts2-core-2.2.3.jar
 WEB-INF/lib/xwork-core-2.2.3.jar
 
  (in addition to the full hibernate plugin)
 
 There is no Hibernate plugin.
 
 Since you don't provide any information regarding the errors 
 you're getting, it's difficult to help much more than that.

For what it is worth, we are using hibernate 3.6.x w/ annotations in struts
2.1.6, 2.1.8, 2.2.x, and SVN HEAD
Using the convention and portlet plugins.

Please post example of failure for debugging.

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-   -
- Jason Pyeron  PD Inc. http://www.pdinc.us -
- Principal Consultant  10 West 24th Street #100-
- +1 (443) 269-1555 x333Baltimore, Maryland 21218   -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 


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



RE: Re : Re : ModelDriven Hibernate Entities

2011-03-11 Thread Martin Gainty
);
}
}
}
}

if (clearableStack  (stack.getContext() != null)  
(newStack.getContext() != null))
stack.getContext().put(ActionContext.CONVERSION_ERRORS, 
newStack.getContext().get(ActionContext.CONVERSION_ERRORS));

addParametersToContext(ActionContext.getContext(), 
acceptableParameters);
}

protected void addParametersToContext(ActionContext ac, MapString, Object 
newParams) 
   {
}


Martin Gainty 
__ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Thu, 10 Mar 2011 19:39:56 -0600
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 From: burtonrho...@gmail.com
 To: user@struts.apache.org
 
 Here is an old thread talking of this same issue.  It appears some
 suggestions are given, but still an issue.  Dave was *marginally*
 following this thread as well ;-)
 
 http://www.coderanch.com/t/58423/Struts/Struts-Model-Driven-fundamentally-flawed
 
 
 On Thu, Mar 10, 2011 at 11:55 AM, CRANFORD, CHRIS
 chris.cranf...@setech.com wrote:
  Dave et el -
 
  I can only conclude that either something is severely lost in my
  understanding of a Struts2 ModelDriven action coupled with Spring3 and
  Hibernate/JPA.  I have tried numerous configuration changes,
  annotations, etc and nothing has appeared to avoid allowing dirty data
  to make it to the database and I just cannot continue with this risk; it
  just jeopardizes integrity.
 
  So unless someone can shed some light on my implementation, showing what
  could be flawed; then I need to go down a different path.
 
  I like the notion that the ModelDriven does a lot of the grunt work for
  me with respect of populating my entity based on form properties and
  keeps my action class very clean and free of form bloat; however I feel
  it puts some risks on the table which I could easily avoid by not
  allowing the framework to modify my persistent entity and force me to
  manage the copy/update of the entity accordingly when applicable.
 
  -Original Message-
  From: Dave Newton [mailto:davelnew...@gmail.com]
  Sent: Thursday, March 10, 2011 10:40 AM
  To: CRANFORD, CHRIS
  Cc: Struts Users Mailing List; Maurizio Cucchiara
  Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
  On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
   Yes the plugin is in the app's lib directory.
 
  Just FYI, that sets the object factory to spring, so Spring is
  instantiating your actions.
 
  (At least it used to.)
 
  Dave
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
  

RE: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-11 Thread CRANFORD, CHRIS
Burton -

I continued to dig around the code yesterday despite my frustration with the 
situation in not being able to find a way to make all this work.  It just 
didn't seem right that this wouldn't work IMO.  After turning on Spring's DEBUG 
and watching the transaction management statements happen, I stumbled across 
what I feel was the culprit.

We have a number of interceptors in our code base that perform various 
initialization activities before the destination action is ever invoked along 
with some which do pre-result and post-result activities.  After looking at my 
interceptor stack, one of them was doing a merge action to write some 
breadcrumb data to an audit table during a pre-result listener.  

So the series of events were:

1. Model Driven action called
2. Model loaded from database (attached entity)
3. Parameters were loaded into model (entity now modified)
4. Validation occurred
5. Execute method fired (simply returns SUCCESS)

Well after the action returns SUCCESS and the PreResultListener gets executed 
that does the EntityManager MERGE call.  This not only persisted the audit 
record to the database but it also commits any changes pending, which would 
include the modified entity in #3 above.

From what I have gathered with OSIV, the transaction is opened and you can 
query the database and make changes to your entities but once a call is made 
to the entity manager to remove/persist/merge an entity, all bets are off; any 
pending changes will be flushed.

So what I decided to test was adding one more interceptor to the stack that 
clears the entity manager after the action's execution; effectively forcing a 
rollback for any entities which were not explicitly persisted.  Then the audit 
interceptor was changed from a pre-result to a post-result action and takes 
place right after the clearing of my entity manager.  Now the audit service 
doesn't persist any pending changes from my action environment.

Anyone see any flaws or issues with this?  So long as my action is making a 
single call in my execute() method to my business logic with my model, then I 
should be ok?
 
 -Original Message-
 From: Burton Rhodes [mailto:burtonrho...@gmail.com]
 Sent: Thursday, March 10, 2011 7:49 PM
 To: Struts Users Mailing List
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
 I have never run into this issue while using OiSV, but couldn't it be
 easily solved by not referencing any related entity or collections
 directly from the model you are modifying in your action?  In other
 words, the object that is in your model (e.g Customer) would be in
 getModel() and in the form for the JSP, but all other data dispayed on
 the page would be reference by a clean version of Customer.  I'm
 sure it can't be that simple, but trying to help.
 
 On Thu, Mar 10, 2011 at 7:39 PM, Burton Rhodes burtonrho...@gmail.com
 wrote:
  Here is an old thread talking of this same issue.  It appears some
  suggestions are given, but still an issue.  Dave was *marginally*
  following this thread as well ;-)
 
  http://www.coderanch.com/t/58423/Struts/Struts-Model-Driven-
 fundamentally-flawed
 
 
  On Thu, Mar 10, 2011 at 11:55 AM, CRANFORD, CHRIS
  chris.cranf...@setech.com wrote:
  Dave et el -
 
  I can only conclude that either something is severely lost in my
  understanding of a Struts2 ModelDriven action coupled with Spring3
 and
  Hibernate/JPA.  I have tried numerous configuration changes,
  annotations, etc and nothing has appeared to avoid allowing dirty
 data
  to make it to the database and I just cannot continue with this
 risk; it
  just jeopardizes integrity.
 
  So unless someone can shed some light on my implementation, showing
 what
  could be flawed; then I need to go down a different path.
 
  I like the notion that the ModelDriven does a lot of the grunt work
 for
  me with respect of populating my entity based on form properties and
  keeps my action class very clean and free of form bloat; however I
 feel
  it puts some risks on the table which I could easily avoid by not
  allowing the framework to modify my persistent entity and force me
 to
  manage the copy/update of the entity accordingly when applicable.
 
  -Original Message-
  From: Dave Newton [mailto:davelnew...@gmail.com]
  Sent: Thursday, March 10, 2011 10:40 AM
  To: CRANFORD, CHRIS
  Cc: Struts Users Mailing List; Maurizio Cucchiara
  Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
  On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
   Yes the plugin is in the app's lib directory.
 
  Just FYI, that sets the object factory to spring, so Spring is
  instantiating your actions.
 
  (At least it used to.)
 
  Dave
 
 
 
  
 -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org

Re: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-11 Thread Burton Rhodes
I think your fix sounds logical.

My true knowledge of the @Transactional annotation isn't that great
although I use it quite a bit (yikes), so this suggestion may be way
off base but would setting the code inside your pre-result or
post-result inteceptor as @Transactional(propagation =
Propagation.REQUIRES_NEW) help in any way?


On Fri, Mar 11, 2011 at 9:10 AM, CRANFORD, CHRIS
chris.cranf...@setech.com wrote:
 Burton -

 I continued to dig around the code yesterday despite my frustration with the 
 situation in not being able to find a way to make all this work.  It just 
 didn't seem right that this wouldn't work IMO.  After turning on Spring's 
 DEBUG and watching the transaction management statements happen, I stumbled 
 across what I feel was the culprit.

 We have a number of interceptors in our code base that perform various 
 initialization activities before the destination action is ever invoked along 
 with some which do pre-result and post-result activities.  After looking at 
 my interceptor stack, one of them was doing a merge action to write some 
 breadcrumb data to an audit table during a pre-result listener.

 So the series of events were:

 1. Model Driven action called
 2. Model loaded from database (attached entity)
 3. Parameters were loaded into model (entity now modified)
 4. Validation occurred
 5. Execute method fired (simply returns SUCCESS)

 Well after the action returns SUCCESS and the PreResultListener gets executed 
 that does the EntityManager MERGE call.  This not only persisted the audit 
 record to the database but it also commits any changes pending, which would 
 include the modified entity in #3 above.

 From what I have gathered with OSIV, the transaction is opened and you can 
 query the database and make changes to your entities but once a call is made 
 to the entity manager to remove/persist/merge an entity, all bets are off; 
 any pending changes will be flushed.

 So what I decided to test was adding one more interceptor to the stack that 
 clears the entity manager after the action's execution; effectively forcing a 
 rollback for any entities which were not explicitly persisted.  Then the 
 audit interceptor was changed from a pre-result to a post-result action and 
 takes place right after the clearing of my entity manager.  Now the audit 
 service doesn't persist any pending changes from my action environment.

 Anyone see any flaws or issues with this?  So long as my action is making a 
 single call in my execute() method to my business logic with my model, then I 
 should be ok?

 -Original Message-
 From: Burton Rhodes [mailto:burtonrho...@gmail.com]
 Sent: Thursday, March 10, 2011 7:49 PM
 To: Struts Users Mailing List
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities

 I have never run into this issue while using OiSV, but couldn't it be
 easily solved by not referencing any related entity or collections
 directly from the model you are modifying in your action?  In other
 words, the object that is in your model (e.g Customer) would be in
 getModel() and in the form for the JSP, but all other data dispayed on
 the page would be reference by a clean version of Customer.  I'm
 sure it can't be that simple, but trying to help.

 On Thu, Mar 10, 2011 at 7:39 PM, Burton Rhodes burtonrho...@gmail.com
 wrote:
  Here is an old thread talking of this same issue.  It appears some
  suggestions are given, but still an issue.  Dave was *marginally*
  following this thread as well ;-)
 
  http://www.coderanch.com/t/58423/Struts/Struts-Model-Driven-
 fundamentally-flawed
 
 
  On Thu, Mar 10, 2011 at 11:55 AM, CRANFORD, CHRIS
  chris.cranf...@setech.com wrote:
  Dave et el -
 
  I can only conclude that either something is severely lost in my
  understanding of a Struts2 ModelDriven action coupled with Spring3
 and
  Hibernate/JPA.  I have tried numerous configuration changes,
  annotations, etc and nothing has appeared to avoid allowing dirty
 data
  to make it to the database and I just cannot continue with this
 risk; it
  just jeopardizes integrity.
 
  So unless someone can shed some light on my implementation, showing
 what
  could be flawed; then I need to go down a different path.
 
  I like the notion that the ModelDriven does a lot of the grunt work
 for
  me with respect of populating my entity based on form properties and
  keeps my action class very clean and free of form bloat; however I
 feel
  it puts some risks on the table which I could easily avoid by not
  allowing the framework to modify my persistent entity and force me
 to
  manage the copy/update of the entity accordingly when applicable.
 
  -Original Message-
  From: Dave Newton [mailto:davelnew...@gmail.com]
  Sent: Thursday, March 10, 2011 10:40 AM
  To: CRANFORD, CHRIS
  Cc: Struts Users Mailing List; Maurizio Cucchiara
  Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
  On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
   Yes the plugin

RE: ModelDriven Hibernate Entities

2011-03-10 Thread adam pinder


i dont use the osiv filter i just make sure the DAO object method returns the 
objects initialised correctly (i.e. all lazy collections that are to be 
accessed are initialised) for how its going to be used - i might have a DAO 
method to return the plain object with no collections initialised and one with 
all collections initialised or somewhere in between.
this gives me full control over persistence etc...
adam

 Subject: ModelDriven  Hibernate Entities
 Date: Wed, 9 Mar 2011 11:34:32 -0600
 From: chris.cranf...@setech.com
 To: user@struts.apache.org
 
 I had started down a path of using the ModelDriven interface from Struts
 because I find it really helps maintain a class action class without
 large numbers of get/set methods for screens that contain a lot of form
 fields.  
 
 However, I am finding at least with how I have attempted to approach
 ModelDriven to have several drawbacks.  For example, by using the OSIV
 (Open Session In View) filter, I am finding that when Struts sets the
 properties on the entity and afterward if an exception is thrown, caught
 and handled and doesn't trigger Hibernate to actually rollback; the
 changes are persisted which leaves my entity in a dirty inconsistent
 state.
 
 How have others solved this by using your entity domain POJOs in your
 view?  
 
 Do you use them detached from the session so that you explicitly have to
 merge them to the session to be persisted?  If so, how do you deal with
 multiple lazy loaded collections in your entity?  
 
 Or would using DTO objects from my service layer a better alternative to
 insure that no data is actually persisted to the database that shouldn't
 be?  
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
  

RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread CRANFORD, CHRIS
Martin -

This is what has me confused.  I don't believe that Hibernate's FLUSHMODE is 
even being set and I am starting to question if that is because of how I am 
using JPA in conjunction with Hibernate with Spring's transaction management 
system.

bean id=entityManagerFactory 
class=org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
  property name=persistenceXmlLocation 
value=classpath*:META-INF/persistence.xml /
  property name=persistenceUnitName value=pu-mrohub /
  property name=dataSource ref=dataSource /
  property name=jpaVendorAdapter
bean class=org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
  property name=database value=SQL_SERVER /  
  property name=showSql value=false /
  property name=generateDdl value=false / 

/bean
  /property   
/bean
 
bean id=transactionManager 
class=org.springframework.orm.jpa.JpaTransactionManager
  property name=entityManagerFactory ref=entityManagerFactory /
  property name=dataSource ref=dataSource /
/bean

jee:jndi-lookup id=dataSource jndi-name=jdbc/mssqlserver 
resource-ref=true/
tx:annotation-driven transaction-manager=transactionManager /
bean id=sessionFactory factory-bean=entityManagerFactory 
factory-method=getSessionFactory /

I question if this is because I am using the JpaTransactionManager?  
I checked Hibernate's FlushMode and it's being set to AUTO.

 -Original Message-
 From: Martin Gainty [mailto:mgai...@hotmail.com]
 Sent: Wednesday, March 09, 2011 9:59 PM
 To: Struts Users Mailing List
 Subject: RE: Re : Re : ModelDriven  Hibernate Entities
 
 
  osiv filter (should) set flushing to never (now manual) to prevent
 accidental writes on the session so
 
 MapString, String properties = new HashMapString, String();
 properties.put( org.hibernate.flushMode, manual );
 javax.persistence.EntityManager em = createEntityManager(
 properties );
 em.getTransaction().begin();
 
 /* * always reopen a new EM and clse the existing one*/
 protected EntityManager createEntityManager(Map properties) {
 if ( em != null  em.isOpen() ) {
 em.close();
 }
 em = factory.createEntityManager( properties );
 return em;
 }
 
 http://docs.jboss.org/hibernate/core/3.2/api/org/hibernate/FlushMode.ht
 ml
 
 Martin
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de
 confidentialité
 
 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
 unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.
 Diese Nachricht dient lediglich dem Austausch von Informationen und
 entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten
 Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt
 uebernehmen.
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
 le destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
 copie de ceci est interdite. Ce message sert à l'information seulement
 et n'aura pas n'importe quel effet légalement obligatoire. Étant donné
 que les email peuvent facilement être sujets à la manipulation, nous ne
 pouvons accepter aucune responsabilité pour le contenu fourni.
 
 
 
 
  Subject: RE: RE: Re : Re : ModelDriven  Hibernate Entities
  Date: Wed, 9 Mar 2011 17:08:01 -0600
  From: chris.cranf...@setech.com
  To: user@struts.apache.org
 
  In the Struts2 Action rather than my service class?
 
   -Original Message-
   From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
   Sent: Wednesday, March 09, 2011 4:20 PM
   To: Struts Users Mailing List
   Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
  
   Have you tried to put the transational annotation in the class
   declaration?
  
   Maurizio Cucchiara
  
   Il giorno 09/mar/2011 21.38, CRANFORD, CHRIS
   chris.cranf...@setech.com
   ha scritto:
I still think this is related to my @Transactional annotation
 maybe.
   
-Original Message-
From: Dave Newton [mailto:davelnew...@gmail.com]
Sent: Wednesday, March 09, 2011 2:16 PM
To: Struts Users Mailing List
Subject: Re: Re : Re : ModelDriven  Hibernate Entities
   
Another reason OSiV filters can be tricky.
   
Dave
   
On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
chris.cranf...@setech.com wrote:
 Francois -

 I use the standard paramsPrepareParamsStack interceptor from
   Struts.

 All I have done on my end is wrap this interceptor stack with
 a
   few
application specific interceptors that control things such as
authentication required, auditing, and logging.  I stepped upon
 my
issue one day when I had returned from lunch and my session had
   timed
out.  I hit

RE: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread CRANFORD, CHRIS
I don't use Spring to instantiate my actions, they're not defined like that.

Spring injects my services into my actions because I use the @Autowired 
annotation.  I then have all my services and DAO classes annotated with the 
@Service and @Repository annotations so that I can wire then through injection. 
 But each action instance itself is instantiated by Struts itself and not 
Spring.  The only other things that I have spring managing is the transactions 
and security.

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Thursday, March 10, 2011 1:41 AM
 To: Struts Users Mailing List
 Cc: CRANFORD, CHRIS
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
 It's exactly what I meant (you can leave in your service class too).
 The object factory must be spring and your class name inside the
 action configuration must contain the bean id (instead of the real
 class name).
 I'm not sure if it works but it worth a try though.
 
 On 10 March 2011 00:08, CRANFORD, CHRIS chris.cranf...@setech.com
 wrote:
  In the Struts2 Action rather than my service class?
 
  -Original Message-
  From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
  Sent: Wednesday, March 09, 2011 4:20 PM
  To: Struts Users Mailing List
  Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
  Have you tried to put the transational annotation in the class
  declaration?
 
  Maurizio Cucchiara
 
  Il giorno 09/mar/2011 21.38, CRANFORD, CHRIS
  chris.cranf...@setech.com
  ha scritto:
   I still think this is related to my @Transactional annotation
 maybe.
  
   -Original Message-
   From: Dave Newton [mailto:davelnew...@gmail.com]
   Sent: Wednesday, March 09, 2011 2:16 PM
   To: Struts Users Mailing List
   Subject: Re: Re : Re : ModelDriven  Hibernate Entities
  
   Another reason OSiV filters can be tricky.
  
   Dave
  
   On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
   chris.cranf...@setech.com wrote:
Francois -
   
I use the standard paramsPrepareParamsStack interceptor from
  Struts.
   
All I have done on my end is wrap this interceptor stack with a
  few
   application specific interceptors that control things such as
   authentication required, auditing, and logging.  I stepped upon
 my
   issue one day when I had returned from lunch and my session had
  timed
   out.  I hit the SAVE button on a form and it redirected me to our
  login
   page.
   
But prior to logging back in; I checked the database and
 noticed
  that
   the record was in fact persisted with the changes from the form.
  All I
   can gather is the following:
   
1. Request comes in for Struts
2. Hibernate Session opened via OSIV
3. Model is loaded from DB via prepare()
4. Struts copies parameters into the model
5. Validation/Interceptors fire
6. Authentication Interceptor detects timed out session,
 returns
   LOGIN
7. User presented with login page
8. OSIV filter closes, changes from #4 persisted.
   
I then created a simple test action where I load a persist
 entity
   from the DB in a ModelDriven action, I call the action passing
   parameters that are properties on the entity.  Then the execute()
   method does nothing more than return SUCCESS which maps to my
   /pages/done.jsp.  The changes are committed.
   
I'd prefer that changes aren't committed unless I explicitly
 call
  to
   do so on the EntityManager; however I understand Hibernate/JPA's
   reasons behind why it works the way it does.
   
   
   
-Original Message-
From: François Rouxel [mailto:rouxe...@yahoo.com]
Sent: Wednesday, March 09, 2011 12:24 PM
To: Struts Users Mailing List
Subject: Re : Re : ModelDriven  Hibernate Entities
   
Hi Chris,
first,
you might have another pb, because struts2 does not change
 your
   model
if a
validation failed. In may case, the model is not changed so
 not
persisted. Do u
use validation and workflow interceptor ?
second,
you are right about MVC pattern, but, just be aware that when
 you
   use
OSIV
pattern, hibernate call backend service when loading data...:-
 ))
  so
your JSP is
not just a view in that case
   
   
I wrote my first mail thinking you wanna rollback after an
  exception
occured.
maybe it's gonna help others.
   
fr/
   
   
 

   
   
   
- Message d'origine 
De : CRANFORD, CHRIS chris.cranf...@setech.com
À : Struts Users Mailing List user@struts.apache.org
Envoyé le : Mer 9 mars 2011, 13h 09min 33s
Objet : RE: Re : ModelDriven  Hibernate Entities
   
Francois -
   
While that may work for you, I wouldn't place anything
 Hibernate
  or
persistence
related in my JSP pages at all.  In my mind, this breaks the
  entire
reasoning
behind MVC and the view

Re: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread Dave Newton
On Thu, Mar 10, 2011 at 11:32 AM, CRANFORD, CHRIS wrote:
 I don't use Spring to instantiate my actions, they're not defined like that.

And you're not using the S2 Spring plugin? (Just for the sake of
completeness; I'm only marginally following this thread.)

Dave

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



RE: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread CRANFORD, CHRIS
Dave -

Yes the plugin is in the app's lib directory.

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com]
 Sent: Thursday, March 10, 2011 10:37 AM
 To: Struts Users Mailing List
 Cc: CRANFORD, CHRIS; Maurizio Cucchiara
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
 On Thu, Mar 10, 2011 at 11:32 AM, CRANFORD, CHRIS wrote:
  I don't use Spring to instantiate my actions, they're not defined
 like that.
 
 And you're not using the S2 Spring plugin? (Just for the sake of
 completeness; I'm only marginally following this thread.)
 
 Dave



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



Re: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread Dave Newton
On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
 Yes the plugin is in the app's lib directory.

Just FYI, that sets the object factory to spring, so Spring is
instantiating your actions.

(At least it used to.)

Dave

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



RE: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread CRANFORD, CHRIS
Oh, learn something new every day :)

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com]
 Sent: Thursday, March 10, 2011 10:40 AM
 To: CRANFORD, CHRIS
 Cc: Struts Users Mailing List; Maurizio Cucchiara
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
 On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
  Yes the plugin is in the app's lib directory.
 
 Just FYI, that sets the object factory to spring, so Spring is
 instantiating your actions.
 
 (At least it used to.)
 
 Dave



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



RE: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread CRANFORD, CHRIS
Annotating @Transactional on the action didn't help.

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Thursday, March 10, 2011 1:41 AM
 To: Struts Users Mailing List
 Cc: CRANFORD, CHRIS
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
 It's exactly what I meant (you can leave in your service class too).
 The object factory must be spring and your class name inside the
 action configuration must contain the bean id (instead of the real
 class name).
 I'm not sure if it works but it worth a try though.
 
 On 10 March 2011 00:08, CRANFORD, CHRIS chris.cranf...@setech.com
 wrote:
  In the Struts2 Action rather than my service class?
 
  -Original Message-
  From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
  Sent: Wednesday, March 09, 2011 4:20 PM
  To: Struts Users Mailing List
  Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
  Have you tried to put the transational annotation in the class
  declaration?
 
  Maurizio Cucchiara
 
  Il giorno 09/mar/2011 21.38, CRANFORD, CHRIS
  chris.cranf...@setech.com
  ha scritto:
   I still think this is related to my @Transactional annotation
 maybe.
  
   -Original Message-
   From: Dave Newton [mailto:davelnew...@gmail.com]
   Sent: Wednesday, March 09, 2011 2:16 PM
   To: Struts Users Mailing List
   Subject: Re: Re : Re : ModelDriven  Hibernate Entities
  
   Another reason OSiV filters can be tricky.
  
   Dave
  
   On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
   chris.cranf...@setech.com wrote:
Francois -
   
I use the standard paramsPrepareParamsStack interceptor from
  Struts.
   
All I have done on my end is wrap this interceptor stack with a
  few
   application specific interceptors that control things such as
   authentication required, auditing, and logging.  I stepped upon
 my
   issue one day when I had returned from lunch and my session had
  timed
   out.  I hit the SAVE button on a form and it redirected me to our
  login
   page.
   
But prior to logging back in; I checked the database and
 noticed
  that
   the record was in fact persisted with the changes from the form.
  All I
   can gather is the following:
   
1. Request comes in for Struts
2. Hibernate Session opened via OSIV
3. Model is loaded from DB via prepare()
4. Struts copies parameters into the model
5. Validation/Interceptors fire
6. Authentication Interceptor detects timed out session,
 returns
   LOGIN
7. User presented with login page
8. OSIV filter closes, changes from #4 persisted.
   
I then created a simple test action where I load a persist
 entity
   from the DB in a ModelDriven action, I call the action passing
   parameters that are properties on the entity.  Then the execute()
   method does nothing more than return SUCCESS which maps to my
   /pages/done.jsp.  The changes are committed.
   
I'd prefer that changes aren't committed unless I explicitly
 call
  to
   do so on the EntityManager; however I understand Hibernate/JPA's
   reasons behind why it works the way it does.
   
   
   
-Original Message-
From: François Rouxel [mailto:rouxe...@yahoo.com]
Sent: Wednesday, March 09, 2011 12:24 PM
To: Struts Users Mailing List
Subject: Re : Re : ModelDriven  Hibernate Entities
   
Hi Chris,
first,
you might have another pb, because struts2 does not change
 your
   model
if a
validation failed. In may case, the model is not changed so
 not
persisted. Do u
use validation and workflow interceptor ?
second,
you are right about MVC pattern, but, just be aware that when
 you
   use
OSIV
pattern, hibernate call backend service when loading data...:-
 ))
  so
your JSP is
not just a view in that case
   
   
I wrote my first mail thinking you wanna rollback after an
  exception
occured.
maybe it's gonna help others.
   
fr/
   
   
 

   
   
   
- Message d'origine 
De : CRANFORD, CHRIS chris.cranf...@setech.com
À : Struts Users Mailing List user@struts.apache.org
Envoyé le : Mer 9 mars 2011, 13h 09min 33s
Objet : RE: Re : ModelDriven  Hibernate Entities
   
Francois -
   
While that may work for you, I wouldn't place anything
 Hibernate
  or
persistence
related in my JSP pages at all.  In my mind, this breaks the
  entire
reasoning
behind MVC and the view simply there to render data.  If the
 view
  is
doing
anything beyond that, I have a design problem, but again
 that's
  my
opinion.
   
But what about when you use the INPUT result code in your
  execute()
method.
   
If I return the user to the INPUT method because maybe I'm not
  using
the Struts
validation framework and doing it myself in my execute()
 method
  or I
have some

RE: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread CRANFORD, CHRIS
Dave et el -

I can only conclude that either something is severely lost in my
understanding of a Struts2 ModelDriven action coupled with Spring3 and
Hibernate/JPA.  I have tried numerous configuration changes,
annotations, etc and nothing has appeared to avoid allowing dirty data
to make it to the database and I just cannot continue with this risk; it
just jeopardizes integrity.

So unless someone can shed some light on my implementation, showing what
could be flawed; then I need to go down a different path.  

I like the notion that the ModelDriven does a lot of the grunt work for
me with respect of populating my entity based on form properties and
keeps my action class very clean and free of form bloat; however I feel
it puts some risks on the table which I could easily avoid by not
allowing the framework to modify my persistent entity and force me to
manage the copy/update of the entity accordingly when applicable.

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com]
 Sent: Thursday, March 10, 2011 10:40 AM
 To: CRANFORD, CHRIS
 Cc: Struts Users Mailing List; Maurizio Cucchiara
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
 On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
  Yes the plugin is in the app's lib directory.
 
 Just FYI, that sets the object factory to spring, so Spring is
 instantiating your actions.
 
 (At least it used to.)
 
 Dave



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



Re: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread Burton Rhodes
Here is an old thread talking of this same issue.  It appears some
suggestions are given, but still an issue.  Dave was *marginally*
following this thread as well ;-)

http://www.coderanch.com/t/58423/Struts/Struts-Model-Driven-fundamentally-flawed


On Thu, Mar 10, 2011 at 11:55 AM, CRANFORD, CHRIS
chris.cranf...@setech.com wrote:
 Dave et el -

 I can only conclude that either something is severely lost in my
 understanding of a Struts2 ModelDriven action coupled with Spring3 and
 Hibernate/JPA.  I have tried numerous configuration changes,
 annotations, etc and nothing has appeared to avoid allowing dirty data
 to make it to the database and I just cannot continue with this risk; it
 just jeopardizes integrity.

 So unless someone can shed some light on my implementation, showing what
 could be flawed; then I need to go down a different path.

 I like the notion that the ModelDriven does a lot of the grunt work for
 me with respect of populating my entity based on form properties and
 keeps my action class very clean and free of form bloat; however I feel
 it puts some risks on the table which I could easily avoid by not
 allowing the framework to modify my persistent entity and force me to
 manage the copy/update of the entity accordingly when applicable.

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com]
 Sent: Thursday, March 10, 2011 10:40 AM
 To: CRANFORD, CHRIS
 Cc: Struts Users Mailing List; Maurizio Cucchiara
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities

 On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
  Yes the plugin is in the app's lib directory.

 Just FYI, that sets the object factory to spring, so Spring is
 instantiating your actions.

 (At least it used to.)

 Dave



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



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



Re: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-10 Thread Burton Rhodes
I have never run into this issue while using OiSV, but couldn't it be
easily solved by not referencing any related entity or collections
directly from the model you are modifying in your action?  In other
words, the object that is in your model (e.g Customer) would be in
getModel() and in the form for the JSP, but all other data dispayed on
the page would be reference by a clean version of Customer.  I'm
sure it can't be that simple, but trying to help.

On Thu, Mar 10, 2011 at 7:39 PM, Burton Rhodes burtonrho...@gmail.com wrote:
 Here is an old thread talking of this same issue.  It appears some
 suggestions are given, but still an issue.  Dave was *marginally*
 following this thread as well ;-)

 http://www.coderanch.com/t/58423/Struts/Struts-Model-Driven-fundamentally-flawed


 On Thu, Mar 10, 2011 at 11:55 AM, CRANFORD, CHRIS
 chris.cranf...@setech.com wrote:
 Dave et el -

 I can only conclude that either something is severely lost in my
 understanding of a Struts2 ModelDriven action coupled with Spring3 and
 Hibernate/JPA.  I have tried numerous configuration changes,
 annotations, etc and nothing has appeared to avoid allowing dirty data
 to make it to the database and I just cannot continue with this risk; it
 just jeopardizes integrity.

 So unless someone can shed some light on my implementation, showing what
 could be flawed; then I need to go down a different path.

 I like the notion that the ModelDriven does a lot of the grunt work for
 me with respect of populating my entity based on form properties and
 keeps my action class very clean and free of form bloat; however I feel
 it puts some risks on the table which I could easily avoid by not
 allowing the framework to modify my persistent entity and force me to
 manage the copy/update of the entity accordingly when applicable.

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com]
 Sent: Thursday, March 10, 2011 10:40 AM
 To: CRANFORD, CHRIS
 Cc: Struts Users Mailing List; Maurizio Cucchiara
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities

 On Thu, Mar 10, 2011 at 11:38 AM, CRANFORD, CHRIS wrote:
  Yes the plugin is in the app's lib directory.

 Just FYI, that sets the object factory to spring, so Spring is
 instantiating your actions.

 (At least it used to.)

 Dave



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




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



ModelDriven Hibernate Entities

2011-03-09 Thread CRANFORD, CHRIS
I had started down a path of using the ModelDriven interface from Struts
because I find it really helps maintain a class action class without
large numbers of get/set methods for screens that contain a lot of form
fields.  

However, I am finding at least with how I have attempted to approach
ModelDriven to have several drawbacks.  For example, by using the OSIV
(Open Session In View) filter, I am finding that when Struts sets the
properties on the entity and afterward if an exception is thrown, caught
and handled and doesn't trigger Hibernate to actually rollback; the
changes are persisted which leaves my entity in a dirty inconsistent
state.

How have others solved this by using your entity domain POJOs in your
view?  

Do you use them detached from the session so that you explicitly have to
merge them to the session to be persisted?  If so, how do you deal with
multiple lazy loaded collections in your entity?  

Or would using DTO objects from my service layer a better alternative to
insure that no data is actually persisted to the database that shouldn't
be?  


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



Re : ModelDriven Hibernate Entities

2011-03-09 Thread François Rouxel
same issue
this how  I fixed it : (the main idea is to redirect to a jsp if an exception 
occured, and the jsp rollback)

create an error page error.jsp
%@page import=com.rdvcentral.util.persistance.HibernateUtil%
%@ page contentType=text/html;charset=UTF-8 language=java  %
%@ taglib prefix=s uri=/struts-tags %
%@ taglib prefix=sj uri=/struts-jquery-tags %


%@page import=org.hibernate.Transaction%
%@page import=org.apache.log4j.Logger%

s:property value=%{logError(exception)}/
%
Transaction tx = new 
HibernateUtil().getSessionFactory().getCurrentSession().getTransaction();
if (tx != null  tx.isActive()) {
tx.rollback();
}
%

In your struts mapping file :

global-results
result name=unhandledException/error.jsp/result
/result
/global-results

global-exception-mappings
exception-mapping exception=java.lang.Exception
result=unhandledException /
/global-exception-mappings

hope it will help you


  




- Message d'origine 
De : CRANFORD, CHRIS chris.cranf...@setech.com
À : Struts Users Mailing List user@struts.apache.org
Envoyé le : Mer 9 mars 2011, 12h 34min 32s
Objet : ModelDriven  Hibernate Entities

I had started down a path of using the ModelDriven interface from Struts
because I find it really helps maintain a class action class without
large numbers of get/set methods for screens that contain a lot of form
fields.  

However, I am finding at least with how I have attempted to approach
ModelDriven to have several drawbacks.  For example, by using the OSIV
(Open Session In View) filter, I am finding that when Struts sets the
properties on the entity and afterward if an exception is thrown, caught
and handled and doesn't trigger Hibernate to actually rollback; the
changes are persisted which leaves my entity in a dirty inconsistent
state.

How have others solved this by using your entity domain POJOs in your
view?  

Do you use them detached from the session so that you explicitly have to
merge them to the session to be persisted?  If so, how do you deal with
multiple lazy loaded collections in your entity?  

Or would using DTO objects from my service layer a better alternative to
insure that no data is actually persisted to the database that shouldn't
be?  


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




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



RE: Re : ModelDriven Hibernate Entities

2011-03-09 Thread CRANFORD, CHRIS
Francois -

While that may work for you, I wouldn't place anything Hibernate or persistence 
related in my JSP pages at all.  In my mind, this breaks the entire reasoning 
behind MVC and the view simply there to render data.  If the view is doing 
anything beyond that, I have a design problem, but again that's my opinion.

But what about when you use the INPUT result code in your execute() method.  

If I return the user to the INPUT method because maybe I'm not using the Struts 
validation framework and doing it myself in my execute() method or I have some 
complex conditions I must check for before I save the data.  In this case, by 
returning INPUT and setting some action field or error messages to be shown to 
the user, the error exception handler isn't fired, thus your rollback isn't 
fired either; leaving your entity persisted with likely dirty data.

 -Original Message-
 From: François Rouxel [mailto:rouxe...@yahoo.com]
 Sent: Wednesday, March 09, 2011 11:43 AM
 To: Struts Users Mailing List
 Subject: Re : ModelDriven  Hibernate Entities
 
 same issue
 this how  I fixed it : (the main idea is to redirect to a jsp if an
 exception
 occured, and the jsp rollback)
 
 create an error page error.jsp
 %@page import=com.rdvcentral.util.persistance.HibernateUtil%
 %@ page contentType=text/html;charset=UTF-8 language=java  %
 %@ taglib prefix=s uri=/struts-tags %
 %@ taglib prefix=sj uri=/struts-jquery-tags %
 
 
 %@page import=org.hibernate.Transaction%
 %@page import=org.apache.log4j.Logger%
 
 s:property value=%{logError(exception)}/
 %
 Transaction tx = new
 HibernateUtil().getSessionFactory().getCurrentSession().getTransaction(
 );
 if (tx != null  tx.isActive()) {
 tx.rollback();
 }
 %
 
 In your struts mapping file :
 
 global-results
 result name=unhandledException/error.jsp/result
 /result
 /global-results
 
 global-exception-mappings
 exception-mapping exception=java.lang.Exception
 result=unhandledException /
 /global-exception-mappings
 
 hope it will help you
 
 
  
 
 
 
 
 - Message d'origine 
 De : CRANFORD, CHRIS chris.cranf...@setech.com
 À : Struts Users Mailing List user@struts.apache.org
 Envoyé le : Mer 9 mars 2011, 12h 34min 32s
 Objet : ModelDriven  Hibernate Entities
 
 I had started down a path of using the ModelDriven interface from
 Struts
 because I find it really helps maintain a class action class without
 large numbers of get/set methods for screens that contain a lot of form
 fields.
 
 However, I am finding at least with how I have attempted to approach
 ModelDriven to have several drawbacks.  For example, by using the OSIV
 (Open Session In View) filter, I am finding that when Struts sets the
 properties on the entity and afterward if an exception is thrown,
 caught
 and handled and doesn't trigger Hibernate to actually rollback; the
 changes are persisted which leaves my entity in a dirty inconsistent
 state.
 
 How have others solved this by using your entity domain POJOs in your
 view?
 
 Do you use them detached from the session so that you explicitly have
 to
 merge them to the session to be persisted?  If so, how do you deal with
 multiple lazy loaded collections in your entity?
 
 Or would using DTO objects from my service layer a better alternative
 to
 insure that no data is actually persisted to the database that
 shouldn't
 be?
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



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



Re: Re : ModelDriven Hibernate Entities

2011-03-09 Thread Dave Newton
On Wed, Mar 9, 2011 at 1:09 PM, CRANFORD, CHRIS wrote:
 I wouldn't place anything Hibernate or persistence related in
 my JSP pages at all.  In my mind, this breaks the entire
 reasoning behind MVC and the view simply there to render data

IMO OSiV filters put non-render stuff into the JSP anyway, it's just
invisible (and may lead to Really Bad performance if people aren't
paying attention).

Dave

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



Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread François Rouxel
Hi Chris,
first, 
you might have another pb, because struts2 does not change your model if a 
validation failed. In may case, the model is not changed so not persisted. Do u 
use validation and workflow interceptor ?
second,
you are right about MVC pattern, but, just be aware that when you use OSIV 
pattern, hibernate call backend service when loading data...:-)) so your JSP is 
not just a view in that case 


I wrote my first mail thinking you wanna rollback after an exception occured. 
maybe it's gonna help others.

fr/


  




- Message d'origine 
De : CRANFORD, CHRIS chris.cranf...@setech.com
À : Struts Users Mailing List user@struts.apache.org
Envoyé le : Mer 9 mars 2011, 13h 09min 33s
Objet : RE: Re : ModelDriven  Hibernate Entities

Francois -

While that may work for you, I wouldn't place anything Hibernate or persistence 
related in my JSP pages at all.  In my mind, this breaks the entire reasoning 
behind MVC and the view simply there to render data.  If the view is doing 
anything beyond that, I have a design problem, but again that's my opinion.

But what about when you use the INPUT result code in your execute() method.  

If I return the user to the INPUT method because maybe I'm not using the Struts 
validation framework and doing it myself in my execute() method or I have some 
complex conditions I must check for before I save the data.  In this case, by 
returning INPUT and setting some action field or error messages to be shown to 
the user, the error exception handler isn't fired, thus your rollback isn't 
fired either; leaving your entity persisted with likely dirty data.

 -Original Message-
 From: François Rouxel [mailto:rouxe...@yahoo.com]
 Sent: Wednesday, March 09, 2011 11:43 AM
 To: Struts Users Mailing List
 Subject: Re : ModelDriven  Hibernate Entities
 
 same issue
 this how  I fixed it : (the main idea is to redirect to a jsp if an
 exception
 occured, and the jsp rollback)
 
 create an error page error.jsp
 %@page import=com.rdvcentral.util.persistance.HibernateUtil%
 %@ page contentType=text/html;charset=UTF-8 language=java  %
 %@ taglib prefix=s uri=/struts-tags %
 %@ taglib prefix=sj uri=/struts-jquery-tags %
 
 
 %@page import=org.hibernate.Transaction%
 %@page import=org.apache.log4j.Logger%
 
 s:property value=%{logError(exception)}/
 %
 Transaction tx = new
 HibernateUtil().getSessionFactory().getCurrentSession().getTransaction(
 );
 if (tx != null  tx.isActive()) {
 tx.rollback();
 }
 %
 
 In your struts mapping file :
 
 global-results
 result name=unhandledException/error.jsp/result
 /result
 /global-results
 
 global-exception-mappings
 exception-mapping exception=java.lang.Exception
 result=unhandledException /
 /global-exception-mappings
 
 hope it will help you
 
 
  
 
 
 
 
 - Message d'origine 
 De : CRANFORD, CHRIS chris.cranf...@setech.com
 À : Struts Users Mailing List user@struts.apache.org
 Envoyé le : Mer 9 mars 2011, 12h 34min 32s
 Objet : ModelDriven  Hibernate Entities
 
 I had started down a path of using the ModelDriven interface from
 Struts
 because I find it really helps maintain a class action class without
 large numbers of get/set methods for screens that contain a lot of form
 fields.
 
 However, I am finding at least with how I have attempted to approach
 ModelDriven to have several drawbacks.  For example, by using the OSIV
 (Open Session In View) filter, I am finding that when Struts sets the
 properties on the entity and afterward if an exception is thrown,
 caught
 and handled and doesn't trigger Hibernate to actually rollback; the
 changes are persisted which leaves my entity in a dirty inconsistent
 state.
 
 How have others solved this by using your entity domain POJOs in your
 view?
 
 Do you use them detached from the session so that you explicitly have
 to
 merge them to the session to be persisted?  If so, how do you deal with
 multiple lazy loaded collections in your entity?
 
 Or would using DTO objects from my service layer a better alternative
 to
 insure that no data is actually persisted to the database that
 shouldn't
 be?
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



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

RE: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread CRANFORD, CHRIS
Francois -

I use the standard paramsPrepareParamsStack interceptor from Struts.

All I have done on my end is wrap this interceptor stack with a few application 
specific interceptors that control things such as authentication required, 
auditing, and logging.  I stepped upon my issue one day when I had returned 
from lunch and my session had timed out.  I hit the SAVE button on a form and 
it redirected me to our login page.  

But prior to logging back in; I checked the database and noticed that the 
record was in fact persisted with the changes from the form.  All I can gather 
is the following:

1. Request comes in for Struts
2. Hibernate Session opened via OSIV
3. Model is loaded from DB via prepare()
4. Struts copies parameters into the model 
5. Validation/Interceptors fire
6. Authentication Interceptor detects timed out session, returns LOGIN
7. User presented with login page
8. OSIV filter closes, changes from #4 persisted.

I then created a simple test action where I load a persist entity from the DB 
in a ModelDriven action, I call the action passing parameters that are 
properties on the entity.  Then the execute() method does nothing more than 
return SUCCESS which maps to my /pages/done.jsp.  The changes are committed.

I'd prefer that changes aren't committed unless I explicitly call to do so on 
the EntityManager; however I understand Hibernate/JPA's reasons behind why it 
works the way it does.



 -Original Message-
 From: François Rouxel [mailto:rouxe...@yahoo.com]
 Sent: Wednesday, March 09, 2011 12:24 PM
 To: Struts Users Mailing List
 Subject: Re : Re : ModelDriven  Hibernate Entities
 
 Hi Chris,
 first,
 you might have another pb, because struts2 does not change your model
 if a
 validation failed. In may case, the model is not changed so not
 persisted. Do u
 use validation and workflow interceptor ?
 second,
 you are right about MVC pattern, but, just be aware that when you use
 OSIV
 pattern, hibernate call backend service when loading data...:-)) so
 your JSP is
 not just a view in that case
 
 
 I wrote my first mail thinking you wanna rollback after an exception
 occured.
 maybe it's gonna help others.
 
 fr/
 
 
  
 
 
 
 
 - Message d'origine 
 De : CRANFORD, CHRIS chris.cranf...@setech.com
 À : Struts Users Mailing List user@struts.apache.org
 Envoyé le : Mer 9 mars 2011, 13h 09min 33s
 Objet : RE: Re : ModelDriven  Hibernate Entities
 
 Francois -
 
 While that may work for you, I wouldn't place anything Hibernate or
 persistence
 related in my JSP pages at all.  In my mind, this breaks the entire
 reasoning
 behind MVC and the view simply there to render data.  If the view is
 doing
 anything beyond that, I have a design problem, but again that's my
 opinion.
 
 But what about when you use the INPUT result code in your execute()
 method.
 
 If I return the user to the INPUT method because maybe I'm not using
 the Struts
 validation framework and doing it myself in my execute() method or I
 have some
 complex conditions I must check for before I save the data.  In this
 case, by
 returning INPUT and setting some action field or error messages to be
 shown to
 the user, the error exception handler isn't fired, thus your rollback
 isn't
 fired either; leaving your entity persisted with likely dirty data.
 
  -Original Message-
  From: François Rouxel [mailto:rouxe...@yahoo.com]
  Sent: Wednesday, March 09, 2011 11:43 AM
  To: Struts Users Mailing List
  Subject: Re : ModelDriven  Hibernate Entities
 
  same issue
  this how  I fixed it : (the main idea is to redirect to a jsp if an
  exception
  occured, and the jsp rollback)
 
  create an error page error.jsp
  %@page import=com.rdvcentral.util.persistance.HibernateUtil%
  %@ page contentType=text/html;charset=UTF-8 language=java  %
  %@ taglib prefix=s uri=/struts-tags %
  %@ taglib prefix=sj uri=/struts-jquery-tags %
 
 
  %@page import=org.hibernate.Transaction%
  %@page import=org.apache.log4j.Logger%
 
  s:property value=%{logError(exception)}/
  %
  Transaction tx = new
 
 HibernateUtil().getSessionFactory().getCurrentSession().getTransaction(
  );
  if (tx != null  tx.isActive()) {
  tx.rollback();
  }
  %
 
  In your struts mapping file :
 
  global-results
  result name=unhandledException/error.jsp/result
  /result
  /global-results
 
  global-exception-mappings
  exception-mapping exception=java.lang.Exception
  result=unhandledException /
  /global-exception-mappings
 
  hope it will help you
 
 
   
  
 
 
 
  - Message d'origine 
  De : CRANFORD, CHRIS chris.cranf...@setech.com
  À : Struts Users Mailing List user@struts.apache.org
  Envoyé le : Mer 9 mars 2011, 12h 34min 32s
  Objet : ModelDriven

Re: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread Chris Pratt
It might just be an order of interceptors problem.  One of your first
interceptors should be your login check.  That should definitely happen
before the standard paramsPrepareParamsStack is run.
  (*Chris*)

On Wed, Mar 9, 2011 at 11:04 AM, CRANFORD, CHRIS
chris.cranf...@setech.comwrote:

 Francois -

 I use the standard paramsPrepareParamsStack interceptor from Struts.

 All I have done on my end is wrap this interceptor stack with a few
 application specific interceptors that control things such as authentication
 required, auditing, and logging.  I stepped upon my issue one day when I had
 returned from lunch and my session had timed out.  I hit the SAVE button on
 a form and it redirected me to our login page.

 But prior to logging back in; I checked the database and noticed that the
 record was in fact persisted with the changes from the form.  All I can
 gather is the following:

 1. Request comes in for Struts
 2. Hibernate Session opened via OSIV
 3. Model is loaded from DB via prepare()
 4. Struts copies parameters into the model
 5. Validation/Interceptors fire
 6. Authentication Interceptor detects timed out session, returns LOGIN
 7. User presented with login page
 8. OSIV filter closes, changes from #4 persisted.

 I then created a simple test action where I load a persist entity from the
 DB in a ModelDriven action, I call the action passing parameters that are
 properties on the entity.  Then the execute() method does nothing more than
 return SUCCESS which maps to my /pages/done.jsp.  The changes are committed.

 I'd prefer that changes aren't committed unless I explicitly call to do so
 on the EntityManager; however I understand Hibernate/JPA's reasons behind
 why it works the way it does.



  -Original Message-
  From: François Rouxel [mailto:rouxe...@yahoo.com]
  Sent: Wednesday, March 09, 2011 12:24 PM
  To: Struts Users Mailing List
  Subject: Re : Re : ModelDriven  Hibernate Entities
 
  Hi Chris,
  first,
  you might have another pb, because struts2 does not change your model
  if a
  validation failed. In may case, the model is not changed so not
  persisted. Do u
  use validation and workflow interceptor ?
  second,
  you are right about MVC pattern, but, just be aware that when you use
  OSIV
  pattern, hibernate call backend service when loading data...:-)) so
  your JSP is
  not just a view in that case
 
 
  I wrote my first mail thinking you wanna rollback after an exception
  occured.
  maybe it's gonna help others.
 
  fr/
 
 
   
  
 
 
 
  - Message d'origine 
  De : CRANFORD, CHRIS chris.cranf...@setech.com
  À : Struts Users Mailing List user@struts.apache.org
  Envoyé le : Mer 9 mars 2011, 13h 09min 33s
  Objet : RE: Re : ModelDriven  Hibernate Entities
 
  Francois -
 
  While that may work for you, I wouldn't place anything Hibernate or
  persistence
  related in my JSP pages at all.  In my mind, this breaks the entire
  reasoning
  behind MVC and the view simply there to render data.  If the view is
  doing
  anything beyond that, I have a design problem, but again that's my
  opinion.
 
  But what about when you use the INPUT result code in your execute()
  method.
 
  If I return the user to the INPUT method because maybe I'm not using
  the Struts
  validation framework and doing it myself in my execute() method or I
  have some
  complex conditions I must check for before I save the data.  In this
  case, by
  returning INPUT and setting some action field or error messages to be
  shown to
  the user, the error exception handler isn't fired, thus your rollback
  isn't
  fired either; leaving your entity persisted with likely dirty data.
 
   -Original Message-
   From: François Rouxel [mailto:rouxe...@yahoo.com]
   Sent: Wednesday, March 09, 2011 11:43 AM
   To: Struts Users Mailing List
   Subject: Re : ModelDriven  Hibernate Entities
  
   same issue
   this how  I fixed it : (the main idea is to redirect to a jsp if an
   exception
   occured, and the jsp rollback)
  
   create an error page error.jsp
   %@page import=com.rdvcentral.util.persistance.HibernateUtil%
   %@ page contentType=text/html;charset=UTF-8 language=java  %
   %@ taglib prefix=s uri=/struts-tags %
   %@ taglib prefix=sj uri=/struts-jquery-tags %
  
  
   %@page import=org.hibernate.Transaction%
   %@page import=org.apache.log4j.Logger%
  
   s:property value=%{logError(exception)}/
   %
   Transaction tx = new
  
  HibernateUtil().getSessionFactory().getCurrentSession().getTransaction(
   );
   if (tx != null  tx.isActive()) {
   tx.rollback();
   }
   %
  
   In your struts mapping file :
  
   global-results
   result name=unhandledException/error.jsp/result
   /result
   /global-results
  
   global-exception-mappings
   exception-mapping exception=java.lang.Exception

RE: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread CRANFORD, CHRIS
Yes, that was the issue, it was interceptor order related.

Now if only I could get the persistent entity not to be flushed under specific 
conditions:

 - Exception 
 - Non-SUCCESS return code, etc.

 -Original Message-
 From: Chris Pratt [mailto:thechrispr...@gmail.com]
 Sent: Wednesday, March 09, 2011 1:35 PM
 To: Struts Users Mailing List
 Subject: Re: Re : Re : ModelDriven  Hibernate Entities
 
 It might just be an order of interceptors problem.  One of your first
 interceptors should be your login check.  That should definitely happen
 before the standard paramsPrepareParamsStack is run.
   (*Chris*)
 
 On Wed, Mar 9, 2011 at 11:04 AM, CRANFORD, CHRIS
 chris.cranf...@setech.comwrote:
 
  Francois -
 
  I use the standard paramsPrepareParamsStack interceptor from Struts.
 
  All I have done on my end is wrap this interceptor stack with a few
  application specific interceptors that control things such as
 authentication
  required, auditing, and logging.  I stepped upon my issue one day
 when I had
  returned from lunch and my session had timed out.  I hit the SAVE
 button on
  a form and it redirected me to our login page.
 
  But prior to logging back in; I checked the database and noticed that
 the
  record was in fact persisted with the changes from the form.  All I
 can
  gather is the following:
 
  1. Request comes in for Struts
  2. Hibernate Session opened via OSIV
  3. Model is loaded from DB via prepare()
  4. Struts copies parameters into the model
  5. Validation/Interceptors fire
  6. Authentication Interceptor detects timed out session, returns
 LOGIN
  7. User presented with login page
  8. OSIV filter closes, changes from #4 persisted.
 
  I then created a simple test action where I load a persist entity
 from the
  DB in a ModelDriven action, I call the action passing parameters that
 are
  properties on the entity.  Then the execute() method does nothing
 more than
  return SUCCESS which maps to my /pages/done.jsp.  The changes are
 committed.
 
  I'd prefer that changes aren't committed unless I explicitly call to
 do so
  on the EntityManager; however I understand Hibernate/JPA's reasons
 behind
  why it works the way it does.
 
 
 
   -Original Message-
   From: François Rouxel [mailto:rouxe...@yahoo.com]
   Sent: Wednesday, March 09, 2011 12:24 PM
   To: Struts Users Mailing List
   Subject: Re : Re : ModelDriven  Hibernate Entities
  
   Hi Chris,
   first,
   you might have another pb, because struts2 does not change your
 model
   if a
   validation failed. In may case, the model is not changed so not
   persisted. Do u
   use validation and workflow interceptor ?
   second,
   you are right about MVC pattern, but, just be aware that when you
 use
   OSIV
   pattern, hibernate call backend service when loading data...:-)) so
   your JSP is
   not just a view in that case
  
  
   I wrote my first mail thinking you wanna rollback after an
 exception
   occured.
   maybe it's gonna help others.
  
   fr/
  
  

   
  
  
  
   - Message d'origine 
   De : CRANFORD, CHRIS chris.cranf...@setech.com
   À : Struts Users Mailing List user@struts.apache.org
   Envoyé le : Mer 9 mars 2011, 13h 09min 33s
   Objet : RE: Re : ModelDriven  Hibernate Entities
  
   Francois -
  
   While that may work for you, I wouldn't place anything Hibernate or
   persistence
   related in my JSP pages at all.  In my mind, this breaks the entire
   reasoning
   behind MVC and the view simply there to render data.  If the view
 is
   doing
   anything beyond that, I have a design problem, but again that's my
   opinion.
  
   But what about when you use the INPUT result code in your execute()
   method.
  
   If I return the user to the INPUT method because maybe I'm not
 using
   the Struts
   validation framework and doing it myself in my execute() method or
 I
   have some
   complex conditions I must check for before I save the data.  In
 this
   case, by
   returning INPUT and setting some action field or error messages to
 be
   shown to
   the user, the error exception handler isn't fired, thus your
 rollback
   isn't
   fired either; leaving your entity persisted with likely dirty data.
  
-Original Message-
From: François Rouxel [mailto:rouxe...@yahoo.com]
Sent: Wednesday, March 09, 2011 11:43 AM
To: Struts Users Mailing List
Subject: Re : ModelDriven  Hibernate Entities
   
same issue
this how  I fixed it : (the main idea is to redirect to a jsp if
 an
exception
occured, and the jsp rollback)
   
create an error page error.jsp
%@page import=com.rdvcentral.util.persistance.HibernateUtil%
%@ page contentType=text/html;charset=UTF-8 language=java
 %
%@ taglib prefix=s uri=/struts-tags %
%@ taglib prefix=sj uri=/struts-jquery-tags %
   
   
%@page import=org.hibernate.Transaction%
%@page import

Re: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread Dave Newton
Another reason OSiV filters can be tricky.

Dave

On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
chris.cranf...@setech.com wrote:
 Francois -

 I use the standard paramsPrepareParamsStack interceptor from Struts.

 All I have done on my end is wrap this interceptor stack with a few 
 application specific interceptors that control things such as authentication 
 required, auditing, and logging.  I stepped upon my issue one day when I had 
 returned from lunch and my session had timed out.  I hit the SAVE button on a 
 form and it redirected me to our login page.

 But prior to logging back in; I checked the database and noticed that the 
 record was in fact persisted with the changes from the form.  All I can 
 gather is the following:

 1. Request comes in for Struts
 2. Hibernate Session opened via OSIV
 3. Model is loaded from DB via prepare()
 4. Struts copies parameters into the model
 5. Validation/Interceptors fire
 6. Authentication Interceptor detects timed out session, returns LOGIN
 7. User presented with login page
 8. OSIV filter closes, changes from #4 persisted.

 I then created a simple test action where I load a persist entity from the DB 
 in a ModelDriven action, I call the action passing parameters that are 
 properties on the entity.  Then the execute() method does nothing more than 
 return SUCCESS which maps to my /pages/done.jsp.  The changes are committed.

 I'd prefer that changes aren't committed unless I explicitly call to do so on 
 the EntityManager; however I understand Hibernate/JPA's reasons behind why it 
 works the way it does.



 -Original Message-
 From: François Rouxel [mailto:rouxe...@yahoo.com]
 Sent: Wednesday, March 09, 2011 12:24 PM
 To: Struts Users Mailing List
 Subject: Re : Re : ModelDriven  Hibernate Entities

 Hi Chris,
 first,
 you might have another pb, because struts2 does not change your model
 if a
 validation failed. In may case, the model is not changed so not
 persisted. Do u
 use validation and workflow interceptor ?
 second,
 you are right about MVC pattern, but, just be aware that when you use
 OSIV
 pattern, hibernate call backend service when loading data...:-)) so
 your JSP is
 not just a view in that case


 I wrote my first mail thinking you wanna rollback after an exception
 occured.
 maybe it's gonna help others.

 fr/


  
 



 - Message d'origine 
 De : CRANFORD, CHRIS chris.cranf...@setech.com
 À : Struts Users Mailing List user@struts.apache.org
 Envoyé le : Mer 9 mars 2011, 13h 09min 33s
 Objet : RE: Re : ModelDriven  Hibernate Entities

 Francois -

 While that may work for you, I wouldn't place anything Hibernate or
 persistence
 related in my JSP pages at all.  In my mind, this breaks the entire
 reasoning
 behind MVC and the view simply there to render data.  If the view is
 doing
 anything beyond that, I have a design problem, but again that's my
 opinion.

 But what about when you use the INPUT result code in your execute()
 method.

 If I return the user to the INPUT method because maybe I'm not using
 the Struts
 validation framework and doing it myself in my execute() method or I
 have some
 complex conditions I must check for before I save the data.  In this
 case, by
 returning INPUT and setting some action field or error messages to be
 shown to
 the user, the error exception handler isn't fired, thus your rollback
 isn't
 fired either; leaving your entity persisted with likely dirty data.

  -Original Message-
  From: François Rouxel [mailto:rouxe...@yahoo.com]
  Sent: Wednesday, March 09, 2011 11:43 AM
  To: Struts Users Mailing List
  Subject: Re : ModelDriven  Hibernate Entities
 
  same issue
  this how  I fixed it : (the main idea is to redirect to a jsp if an
  exception
  occured, and the jsp rollback)
 
  create an error page error.jsp
  %@page import=com.rdvcentral.util.persistance.HibernateUtil%
  %@ page contentType=text/html;charset=UTF-8 language=java  %
  %@ taglib prefix=s uri=/struts-tags %
  %@ taglib prefix=sj uri=/struts-jquery-tags %
 
 
  %@page import=org.hibernate.Transaction%
  %@page import=org.apache.log4j.Logger%
 
  s:property value=%{logError(exception)}/
  %
      Transaction tx = new
 
 HibernateUtil().getSessionFactory().getCurrentSession().getTransaction(
  );
      if (tx != null  tx.isActive()) {
          tx.rollback();
      }
  %
 
  In your struts mapping file :
 
          global-results
              result name=unhandledException/error.jsp/result
              /result
          /global-results
 
          global-exception-mappings
              exception-mapping exception=java.lang.Exception
                  result=unhandledException /
          /global-exception-mappings
 
  hope it will help you
 
 
   
  
 
 
 
  - Message d'origine 
  De : CRANFORD, CHRIS

RE: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread CRANFORD, CHRIS
I still think this is related to my @Transactional annotation maybe.

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com]
 Sent: Wednesday, March 09, 2011 2:16 PM
 To: Struts Users Mailing List
 Subject: Re: Re : Re : ModelDriven  Hibernate Entities
 
 Another reason OSiV filters can be tricky.
 
 Dave
 
 On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
 chris.cranf...@setech.com wrote:
  Francois -
 
  I use the standard paramsPrepareParamsStack interceptor from Struts.
 
  All I have done on my end is wrap this interceptor stack with a few
 application specific interceptors that control things such as
 authentication required, auditing, and logging.  I stepped upon my
 issue one day when I had returned from lunch and my session had timed
 out.  I hit the SAVE button on a form and it redirected me to our login
 page.
 
  But prior to logging back in; I checked the database and noticed that
 the record was in fact persisted with the changes from the form.  All I
 can gather is the following:
 
  1. Request comes in for Struts
  2. Hibernate Session opened via OSIV
  3. Model is loaded from DB via prepare()
  4. Struts copies parameters into the model
  5. Validation/Interceptors fire
  6. Authentication Interceptor detects timed out session, returns
 LOGIN
  7. User presented with login page
  8. OSIV filter closes, changes from #4 persisted.
 
  I then created a simple test action where I load a persist entity
 from the DB in a ModelDriven action, I call the action passing
 parameters that are properties on the entity.  Then the execute()
 method does nothing more than return SUCCESS which maps to my
 /pages/done.jsp.  The changes are committed.
 
  I'd prefer that changes aren't committed unless I explicitly call to
 do so on the EntityManager; however I understand Hibernate/JPA's
 reasons behind why it works the way it does.
 
 
 
  -Original Message-
  From: François Rouxel [mailto:rouxe...@yahoo.com]
  Sent: Wednesday, March 09, 2011 12:24 PM
  To: Struts Users Mailing List
  Subject: Re : Re : ModelDriven  Hibernate Entities
 
  Hi Chris,
  first,
  you might have another pb, because struts2 does not change your
 model
  if a
  validation failed. In may case, the model is not changed so not
  persisted. Do u
  use validation and workflow interceptor ?
  second,
  you are right about MVC pattern, but, just be aware that when you
 use
  OSIV
  pattern, hibernate call backend service when loading data...:-)) so
  your JSP is
  not just a view in that case
 
 
  I wrote my first mail thinking you wanna rollback after an exception
  occured.
  maybe it's gonna help others.
 
  fr/
 
 
   
  
 
 
 
  - Message d'origine 
  De : CRANFORD, CHRIS chris.cranf...@setech.com
  À : Struts Users Mailing List user@struts.apache.org
  Envoyé le : Mer 9 mars 2011, 13h 09min 33s
  Objet : RE: Re : ModelDriven  Hibernate Entities
 
  Francois -
 
  While that may work for you, I wouldn't place anything Hibernate or
  persistence
  related in my JSP pages at all.  In my mind, this breaks the entire
  reasoning
  behind MVC and the view simply there to render data.  If the view is
  doing
  anything beyond that, I have a design problem, but again that's my
  opinion.
 
  But what about when you use the INPUT result code in your execute()
  method.
 
  If I return the user to the INPUT method because maybe I'm not using
  the Struts
  validation framework and doing it myself in my execute() method or I
  have some
  complex conditions I must check for before I save the data.  In this
  case, by
  returning INPUT and setting some action field or error messages to
 be
  shown to
  the user, the error exception handler isn't fired, thus your
 rollback
  isn't
  fired either; leaving your entity persisted with likely dirty data.
 
   -Original Message-
   From: François Rouxel [mailto:rouxe...@yahoo.com]
   Sent: Wednesday, March 09, 2011 11:43 AM
   To: Struts Users Mailing List
   Subject: Re : ModelDriven  Hibernate Entities
  
   same issue
   this how  I fixed it : (the main idea is to redirect to a jsp if
 an
   exception
   occured, and the jsp rollback)
  
   create an error page error.jsp
   %@page import=com.rdvcentral.util.persistance.HibernateUtil%
   %@ page contentType=text/html;charset=UTF-8 language=java  %
   %@ taglib prefix=s uri=/struts-tags %
   %@ taglib prefix=sj uri=/struts-jquery-tags %
  
  
   %@page import=org.hibernate.Transaction%
   %@page import=org.apache.log4j.Logger%
  
   s:property value=%{logError(exception)}/
   %
       Transaction tx = new
  
 
 HibernateUtil().getSessionFactory().getCurrentSession().getTransaction(
   );
       if (tx != null  tx.isActive()) {
           tx.rollback();
       }
   %
  
   In your struts mapping file :
  
           global-results
               result name=unhandledException/error.jsp/result

Re: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread Maurizio Cucchiara
Have you tried to put the transational annotation in the class declaration?

Maurizio Cucchiara

Il giorno 09/mar/2011 21.38, CRANFORD, CHRIS chris.cranf...@setech.com
ha scritto:
 I still think this is related to my @Transactional annotation maybe.

 -Original Message-
 From: Dave Newton [mailto:davelnew...@gmail.com]
 Sent: Wednesday, March 09, 2011 2:16 PM
 To: Struts Users Mailing List
 Subject: Re: Re : Re : ModelDriven  Hibernate Entities

 Another reason OSiV filters can be tricky.

 Dave

 On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
 chris.cranf...@setech.com wrote:
  Francois -
 
  I use the standard paramsPrepareParamsStack interceptor from Struts.
 
  All I have done on my end is wrap this interceptor stack with a few
 application specific interceptors that control things such as
 authentication required, auditing, and logging.  I stepped upon my
 issue one day when I had returned from lunch and my session had timed
 out.  I hit the SAVE button on a form and it redirected me to our login
 page.
 
  But prior to logging back in; I checked the database and noticed that
 the record was in fact persisted with the changes from the form.  All I
 can gather is the following:
 
  1. Request comes in for Struts
  2. Hibernate Session opened via OSIV
  3. Model is loaded from DB via prepare()
  4. Struts copies parameters into the model
  5. Validation/Interceptors fire
  6. Authentication Interceptor detects timed out session, returns
 LOGIN
  7. User presented with login page
  8. OSIV filter closes, changes from #4 persisted.
 
  I then created a simple test action where I load a persist entity
 from the DB in a ModelDriven action, I call the action passing
 parameters that are properties on the entity.  Then the execute()
 method does nothing more than return SUCCESS which maps to my
 /pages/done.jsp.  The changes are committed.
 
  I'd prefer that changes aren't committed unless I explicitly call to
 do so on the EntityManager; however I understand Hibernate/JPA's
 reasons behind why it works the way it does.
 
 
 
  -Original Message-
  From: François Rouxel [mailto:rouxe...@yahoo.com]
  Sent: Wednesday, March 09, 2011 12:24 PM
  To: Struts Users Mailing List
  Subject: Re : Re : ModelDriven  Hibernate Entities
 
  Hi Chris,
  first,
  you might have another pb, because struts2 does not change your
 model
  if a
  validation failed. In may case, the model is not changed so not
  persisted. Do u
  use validation and workflow interceptor ?
  second,
  you are right about MVC pattern, but, just be aware that when you
 use
  OSIV
  pattern, hibernate call backend service when loading data...:-)) so
  your JSP is
  not just a view in that case
 
 
  I wrote my first mail thinking you wanna rollback after an exception
  occured.
  maybe it's gonna help others.
 
  fr/
 
 
   
  
 
 
 
  - Message d'origine 
  De : CRANFORD, CHRIS chris.cranf...@setech.com
  À : Struts Users Mailing List user@struts.apache.org
  Envoyé le : Mer 9 mars 2011, 13h 09min 33s
  Objet : RE: Re : ModelDriven  Hibernate Entities
 
  Francois -
 
  While that may work for you, I wouldn't place anything Hibernate or
  persistence
  related in my JSP pages at all.  In my mind, this breaks the entire
  reasoning
  behind MVC and the view simply there to render data.  If the view is
  doing
  anything beyond that, I have a design problem, but again that's my
  opinion.
 
  But what about when you use the INPUT result code in your execute()
  method.
 
  If I return the user to the INPUT method because maybe I'm not using
  the Struts
  validation framework and doing it myself in my execute() method or I
  have some
  complex conditions I must check for before I save the data.  In this
  case, by
  returning INPUT and setting some action field or error messages to
 be
  shown to
  the user, the error exception handler isn't fired, thus your
 rollback
  isn't
  fired either; leaving your entity persisted with likely dirty data.
 
   -Original Message-
   From: François Rouxel [mailto:rouxe...@yahoo.com]
   Sent: Wednesday, March 09, 2011 11:43 AM
   To: Struts Users Mailing List
   Subject: Re : ModelDriven  Hibernate Entities
  
   same issue
   this how  I fixed it : (the main idea is to redirect to a jsp if
 an
   exception
   occured, and the jsp rollback)
  
   create an error page error.jsp
   %@page import=com.rdvcentral.util.persistance.HibernateUtil%
   %@ page contentType=text/html;charset=UTF-8 language=java  %
   %@ taglib prefix=s uri=/struts-tags %
   %@ taglib prefix=sj uri=/struts-jquery-tags %
  
  
   %@page import=org.hibernate.Transaction%
   %@page import=org.apache.log4j.Logger%
  
   s:property value=%{logError(exception)}/
   %
   Transaction tx = new
  
 
 HibernateUtil().getSessionFactory().getCurrentSession().getTransaction(
   );
   if (tx != null  tx.isActive

RE: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread CRANFORD, CHRIS
In the Struts2 Action rather than my service class?

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Wednesday, March 09, 2011 4:20 PM
 To: Struts Users Mailing List
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
 
 Have you tried to put the transational annotation in the class
 declaration?
 
 Maurizio Cucchiara
 
 Il giorno 09/mar/2011 21.38, CRANFORD, CHRIS
 chris.cranf...@setech.com
 ha scritto:
  I still think this is related to my @Transactional annotation maybe.
 
  -Original Message-
  From: Dave Newton [mailto:davelnew...@gmail.com]
  Sent: Wednesday, March 09, 2011 2:16 PM
  To: Struts Users Mailing List
  Subject: Re: Re : Re : ModelDriven  Hibernate Entities
 
  Another reason OSiV filters can be tricky.
 
  Dave
 
  On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
  chris.cranf...@setech.com wrote:
   Francois -
  
   I use the standard paramsPrepareParamsStack interceptor from
 Struts.
  
   All I have done on my end is wrap this interceptor stack with a
 few
  application specific interceptors that control things such as
  authentication required, auditing, and logging.  I stepped upon my
  issue one day when I had returned from lunch and my session had
 timed
  out.  I hit the SAVE button on a form and it redirected me to our
 login
  page.
  
   But prior to logging back in; I checked the database and noticed
 that
  the record was in fact persisted with the changes from the form.
 All I
  can gather is the following:
  
   1. Request comes in for Struts
   2. Hibernate Session opened via OSIV
   3. Model is loaded from DB via prepare()
   4. Struts copies parameters into the model
   5. Validation/Interceptors fire
   6. Authentication Interceptor detects timed out session, returns
  LOGIN
   7. User presented with login page
   8. OSIV filter closes, changes from #4 persisted.
  
   I then created a simple test action where I load a persist entity
  from the DB in a ModelDriven action, I call the action passing
  parameters that are properties on the entity.  Then the execute()
  method does nothing more than return SUCCESS which maps to my
  /pages/done.jsp.  The changes are committed.
  
   I'd prefer that changes aren't committed unless I explicitly call
 to
  do so on the EntityManager; however I understand Hibernate/JPA's
  reasons behind why it works the way it does.
  
  
  
   -Original Message-
   From: François Rouxel [mailto:rouxe...@yahoo.com]
   Sent: Wednesday, March 09, 2011 12:24 PM
   To: Struts Users Mailing List
   Subject: Re : Re : ModelDriven  Hibernate Entities
  
   Hi Chris,
   first,
   you might have another pb, because struts2 does not change your
  model
   if a
   validation failed. In may case, the model is not changed so not
   persisted. Do u
   use validation and workflow interceptor ?
   second,
   you are right about MVC pattern, but, just be aware that when you
  use
   OSIV
   pattern, hibernate call backend service when loading data...:-))
 so
   your JSP is
   not just a view in that case
  
  
   I wrote my first mail thinking you wanna rollback after an
 exception
   occured.
   maybe it's gonna help others.
  
   fr/
  
  

   
  
  
  
   - Message d'origine 
   De : CRANFORD, CHRIS chris.cranf...@setech.com
   À : Struts Users Mailing List user@struts.apache.org
   Envoyé le : Mer 9 mars 2011, 13h 09min 33s
   Objet : RE: Re : ModelDriven  Hibernate Entities
  
   Francois -
  
   While that may work for you, I wouldn't place anything Hibernate
 or
   persistence
   related in my JSP pages at all.  In my mind, this breaks the
 entire
   reasoning
   behind MVC and the view simply there to render data.  If the view
 is
   doing
   anything beyond that, I have a design problem, but again that's
 my
   opinion.
  
   But what about when you use the INPUT result code in your
 execute()
   method.
  
   If I return the user to the INPUT method because maybe I'm not
 using
   the Struts
   validation framework and doing it myself in my execute() method
 or I
   have some
   complex conditions I must check for before I save the data.  In
 this
   case, by
   returning INPUT and setting some action field or error messages
 to
  be
   shown to
   the user, the error exception handler isn't fired, thus your
  rollback
   isn't
   fired either; leaving your entity persisted with likely dirty
 data.
  
-Original Message-
From: François Rouxel [mailto:rouxe...@yahoo.com]
Sent: Wednesday, March 09, 2011 11:43 AM
To: Struts Users Mailing List
Subject: Re : ModelDriven  Hibernate Entities
   
same issue
this how  I fixed it : (the main idea is to redirect to a jsp
 if
  an
exception
occured, and the jsp rollback)
   
create an error page error.jsp
%@page
 import=com.rdvcentral.util.persistance.HibernateUtil%
%@ page

RE: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread Martin Gainty

 osiv filter (should) set flushing to never (now manual) to prevent accidental 
writes on the session so

MapString, String properties = new HashMapString, String();
properties.put( org.hibernate.flushMode, manual );
javax.persistence.EntityManager em = createEntityManager( properties );
em.getTransaction().begin();

/* * always reopen a new EM and clse the existing one*/
protected EntityManager createEntityManager(Map properties) {
if ( em != null  em.isOpen() ) {
em.close();
}
em = factory.createEntityManager( properties );
return em;
}

http://docs.jboss.org/hibernate/core/3.2/api/org/hibernate/FlushMode.html

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Subject: RE: RE: Re : Re : ModelDriven  Hibernate Entities
 Date: Wed, 9 Mar 2011 17:08:01 -0600
 From: chris.cranf...@setech.com
 To: user@struts.apache.org
 
 In the Struts2 Action rather than my service class?
 
  -Original Message-
  From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
  Sent: Wednesday, March 09, 2011 4:20 PM
  To: Struts Users Mailing List
  Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities
  
  Have you tried to put the transational annotation in the class
  declaration?
  
  Maurizio Cucchiara
  
  Il giorno 09/mar/2011 21.38, CRANFORD, CHRIS
  chris.cranf...@setech.com
  ha scritto:
   I still think this is related to my @Transactional annotation maybe.
  
   -Original Message-
   From: Dave Newton [mailto:davelnew...@gmail.com]
   Sent: Wednesday, March 09, 2011 2:16 PM
   To: Struts Users Mailing List
   Subject: Re: Re : Re : ModelDriven  Hibernate Entities
  
   Another reason OSiV filters can be tricky.
  
   Dave
  
   On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
   chris.cranf...@setech.com wrote:
Francois -
   
I use the standard paramsPrepareParamsStack interceptor from
  Struts.
   
All I have done on my end is wrap this interceptor stack with a
  few
   application specific interceptors that control things such as
   authentication required, auditing, and logging.  I stepped upon my
   issue one day when I had returned from lunch and my session had
  timed
   out.  I hit the SAVE button on a form and it redirected me to our
  login
   page.
   
But prior to logging back in; I checked the database and noticed
  that
   the record was in fact persisted with the changes from the form.
  All I
   can gather is the following:
   
1. Request comes in for Struts
2. Hibernate Session opened via OSIV
3. Model is loaded from DB via prepare()
4. Struts copies parameters into the model
5. Validation/Interceptors fire
6. Authentication Interceptor detects timed out session, returns
   LOGIN
7. User presented with login page
8. OSIV filter closes, changes from #4 persisted.
   
I then created a simple test action where I load a persist entity
   from the DB in a ModelDriven action, I call the action passing
   parameters that are properties on the entity.  Then the execute()
   method does nothing more than return SUCCESS which maps to my
   /pages/done.jsp.  The changes are committed.
   
I'd prefer that changes aren't committed unless I explicitly call
  to
   do so on the EntityManager; however I understand Hibernate/JPA's
   reasons behind why it works the way it does.
   
   
   
-Original Message-
From: François Rouxel [mailto:rouxe...@yahoo.com]
Sent: Wednesday, March 09, 2011 12:24 PM
To: Struts Users Mailing List
Subject: Re : Re : ModelDriven  Hibernate Entities
   
Hi Chris,
first,
you might have another pb, because struts2 does not change your
   model
if a
validation failed. In may case, the model is not changed so not
persisted. Do u
use validation and workflow interceptor ?
second,
you are right about MVC pattern, but, just be aware that when you
   use
OSIV
pattern

Re: RE: Re : Re : ModelDriven Hibernate Entities

2011-03-09 Thread Maurizio Cucchiara
It's exactly what I meant (you can leave in your service class too).
The object factory must be spring and your class name inside the
action configuration must contain the bean id (instead of the real
class name).
I'm not sure if it works but it worth a try though.

On 10 March 2011 00:08, CRANFORD, CHRIS chris.cranf...@setech.com wrote:
 In the Struts2 Action rather than my service class?

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Wednesday, March 09, 2011 4:20 PM
 To: Struts Users Mailing List
 Subject: Re: RE: Re : Re : ModelDriven  Hibernate Entities

 Have you tried to put the transational annotation in the class
 declaration?

 Maurizio Cucchiara

 Il giorno 09/mar/2011 21.38, CRANFORD, CHRIS
 chris.cranf...@setech.com
 ha scritto:
  I still think this is related to my @Transactional annotation maybe.
 
  -Original Message-
  From: Dave Newton [mailto:davelnew...@gmail.com]
  Sent: Wednesday, March 09, 2011 2:16 PM
  To: Struts Users Mailing List
  Subject: Re: Re : Re : ModelDriven  Hibernate Entities
 
  Another reason OSiV filters can be tricky.
 
  Dave
 
  On Wed, Mar 9, 2011 at 2:04 PM, CRANFORD, CHRIS
  chris.cranf...@setech.com wrote:
   Francois -
  
   I use the standard paramsPrepareParamsStack interceptor from
 Struts.
  
   All I have done on my end is wrap this interceptor stack with a
 few
  application specific interceptors that control things such as
  authentication required, auditing, and logging.  I stepped upon my
  issue one day when I had returned from lunch and my session had
 timed
  out.  I hit the SAVE button on a form and it redirected me to our
 login
  page.
  
   But prior to logging back in; I checked the database and noticed
 that
  the record was in fact persisted with the changes from the form.
 All I
  can gather is the following:
  
   1. Request comes in for Struts
   2. Hibernate Session opened via OSIV
   3. Model is loaded from DB via prepare()
   4. Struts copies parameters into the model
   5. Validation/Interceptors fire
   6. Authentication Interceptor detects timed out session, returns
  LOGIN
   7. User presented with login page
   8. OSIV filter closes, changes from #4 persisted.
  
   I then created a simple test action where I load a persist entity
  from the DB in a ModelDriven action, I call the action passing
  parameters that are properties on the entity.  Then the execute()
  method does nothing more than return SUCCESS which maps to my
  /pages/done.jsp.  The changes are committed.
  
   I'd prefer that changes aren't committed unless I explicitly call
 to
  do so on the EntityManager; however I understand Hibernate/JPA's
  reasons behind why it works the way it does.
  
  
  
   -Original Message-
   From: François Rouxel [mailto:rouxe...@yahoo.com]
   Sent: Wednesday, March 09, 2011 12:24 PM
   To: Struts Users Mailing List
   Subject: Re : Re : ModelDriven  Hibernate Entities
  
   Hi Chris,
   first,
   you might have another pb, because struts2 does not change your
  model
   if a
   validation failed. In may case, the model is not changed so not
   persisted. Do u
   use validation and workflow interceptor ?
   second,
   you are right about MVC pattern, but, just be aware that when you
  use
   OSIV
   pattern, hibernate call backend service when loading data...:-))
 so
   your JSP is
   not just a view in that case
  
  
   I wrote my first mail thinking you wanna rollback after an
 exception
   occured.
   maybe it's gonna help others.
  
   fr/
  
  
    
   
  
  
  
   - Message d'origine 
   De : CRANFORD, CHRIS chris.cranf...@setech.com
   À : Struts Users Mailing List user@struts.apache.org
   Envoyé le : Mer 9 mars 2011, 13h 09min 33s
   Objet : RE: Re : ModelDriven  Hibernate Entities
  
   Francois -
  
   While that may work for you, I wouldn't place anything Hibernate
 or
   persistence
   related in my JSP pages at all.  In my mind, this breaks the
 entire
   reasoning
   behind MVC and the view simply there to render data.  If the view
 is
   doing
   anything beyond that, I have a design problem, but again that's
 my
   opinion.
  
   But what about when you use the INPUT result code in your
 execute()
   method.
  
   If I return the user to the INPUT method because maybe I'm not
 using
   the Struts
   validation framework and doing it myself in my execute() method
 or I
   have some
   complex conditions I must check for before I save the data.  In
 this
   case, by
   returning INPUT and setting some action field or error messages
 to
  be
   shown to
   the user, the error exception handler isn't fired, thus your
  rollback
   isn't
   fired either; leaving your entity persisted with likely dirty
 data.
  
-Original Message-
From: François Rouxel [mailto:rouxe...@yahoo.com]
Sent: Wednesday, March 09, 2011 11:43 AM

generate SQL Hibernate Query using session

2011-02-17 Thread Jerson John
Hi,
  I am trying to generate SQL query using session.createSQLQuery and
returning the list object..This select query contains joins and so it cannot
be mapped to any of my model objects.How can I now get the values in my jsp
page using iterator tag in Struts 2...

Please help me on this

Many Thanks and Regards,

Jerson




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



Re: generate SQL Hibernate Query using session

2011-02-17 Thread Dave Newton
What does having joins have to do with not being able to map to your data
model?

Dave
 On Feb 17, 2011 8:43 PM, Jerson John jer...@cprvision.com wrote:
 Hi,
 I am trying to generate SQL query using session.createSQLQuery and
 returning the list object..This select query contains joins and so it
cannot
 be mapped to any of my model objects.How can I now get the values in my
jsp
 page using iterator tag in Struts 2...

 Please help me on this

 Many Thanks and Regards,

 Jerson




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



RE: generate SQL Hibernate Query using session

2011-02-17 Thread Jerson John
Hi,
  Thanks for your reply.
Actually I am bit confused here..What I do normally is that get the List of
the model calss from the HQL Query and cast it and iterate it in jsp...Here
If there values from more than one table then I can't cast it to any model
class because of the difference in properties.Please advice me a approach
for thisThanks in advance

Many Thanks and Regards,

Jerson

-Original Message-
From: Dave Newton [mailto:davelnew...@gmail.com] 
Sent: Friday, February 18, 2011 10:34 AM
To: Struts Users Mailing List
Subject: Re: generate SQL Hibernate Query using session

What does having joins have to do with not being able to map to your data
model?

Dave
 On Feb 17, 2011 8:43 PM, Jerson John jer...@cprvision.com wrote:
 Hi,
 I am trying to generate SQL query using session.createSQLQuery and
 returning the list object..This select query contains joins and so it
cannot
 be mapped to any of my model objects.How can I now get the values in my
jsp
 page using iterator tag in Struts 2...

 Please help me on this

 Many Thanks and Regards,

 Jerson




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




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



RE: generate SQL Hibernate Query using session

2011-02-17 Thread Jerson John
Hi,
 By the way My query is below

select b.Name as brand,a.Name as
eventname,c.Code,a.EventStartDate,a.EventEndDate,a.EventObjective,a.EventTyp
e from ASSET a,Brand b,LPDCOUNTRY c where a.Brand=b.id and a.Country=c.id

It also says brand property not defined...Is there any syntax error...I
couldn't find any

Thanks in advance

Many Thanks and Regards,

Jerson


From: Jerson John [mailto:jer...@cprvision.com] 
Sent: Friday, February 18, 2011 10:53 AM
To: 'Struts Users Mailing List'
Subject: RE: generate SQL Hibernate Query using session

Hi,
  Thanks for your reply.
Actually I am bit confused here..What I do normally is that get the List of
the model calss from the HQL Query and cast it and iterate it in jsp...Here
If there values from more than one table then I can't cast it to any model
class because of the difference in properties.Please advice me a approach
for thisThanks in advance

Many Thanks and Regards,

Jerson

-Original Message-
From: Dave Newton [mailto:davelnew...@gmail.com] 
Sent: Friday, February 18, 2011 10:34 AM
To: Struts Users Mailing List
Subject: Re: generate SQL Hibernate Query using session

What does having joins have to do with not being able to map to your data
model?

Dave
 On Feb 17, 2011 8:43 PM, Jerson John jer...@cprvision.com wrote:
 Hi,
 I am trying to generate SQL query using session.createSQLQuery and
 returning the list object..This select query contains joins and so it
cannot
 be mapped to any of my model objects.How can I now get the values in my
jsp
 page using iterator tag in Struts 2...

 Please help me on this

 Many Thanks and Regards,

 Jerson




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




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



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



Re: generate SQL Hibernate Query using session

2011-02-17 Thread Mead Lai
I think you may use the Composite Class in Hibernate.
Query q = session.createQuery
( select new NewCompositeClass(members, classInfo.className)  +
 from Members members, ClassInfo classInfo  +
 where members.level = classInfo.classCode );
and you need a class:NewCompositeClass.java

Regards,
Mead


RE: generate SQL Hibernate Query using session

2011-02-17 Thread CRANFORD, CHRIS
Jerson -

What I would likely suggest you consider is creating a DTO object that
resembles your result from the SQLQuery.  You can then use one of the
stock Hibernate Transformers to convert the SQL results into instances
of this DTO Bean and then you can return the beans to your view to
iterate over.

Here's a simple example:

public List getQueryUsingResultTransformer() {
  SQLQuery query = session.createSQLQuery(SELECT SOME FANCY DATA);
  /* do other stuff */
  query.setResultTransformer(new
AliasToBeanResultTransformer(YourDTO.class));
  return(query.list());
}

Another alternative would be to iterate the result set yourself 

public ListYourDTO getQueryDoingSelfInstantiation() {
  ListYourDTO myList = new ArrayListYourDTO();
  SQLQuery query = session.createSQLQuery(SELECT SOME FANCY DATA);
  /* do other stuff */
  List results = query.list();
  Iterator i = results.iterator();
  while(i.hasNext())
  {
Object[] row = (Object[]) i.next();
/* each row has a 0-based index for each column of query */
YourDTO dto = new YourDTO();
/* set values on dto */
myList.add(dto);
  }
  return(myList);
}

Both basically do the same; however I find that using the AliasToBean
transformer is much cleaner code :)

Chris

 -Original Message-
 From: Jerson John [mailto:jer...@cprvision.com]
 Sent: Thursday, February 17, 2011 7:43 PM
 To: user@struts.apache.org
 Subject: generate SQL Hibernate Query using session
 
 Hi,
   I am trying to generate SQL query using session.createSQLQuery and
 returning the list object..This select query contains joins and so it
 cannot
 be mapped to any of my model objects.How can I now get the values in
my
 jsp
 page using iterator tag in Struts 2...
 
 Please help me on this
 
 Many Thanks and Regards,
 
 Jerson
 
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



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



RE: generate SQL Hibernate Query using session

2011-02-17 Thread Jerson John
Hi,
   It was really a great help from you guys...Thanks a lotfinally I
manged to do some way..

Appreciate ur help...

Many Thanks and Regards,

Jerson


-Original Message-
From: CRANFORD, CHRIS [mailto:chris.cranf...@setech.com] 
Sent: Friday, February 18, 2011 11:23 AM
To: Struts Users Mailing List
Subject: RE: generate SQL Hibernate Query using session

Jerson -

What I would likely suggest you consider is creating a DTO object that
resembles your result from the SQLQuery.  You can then use one of the
stock Hibernate Transformers to convert the SQL results into instances
of this DTO Bean and then you can return the beans to your view to
iterate over.

Here's a simple example:

public List getQueryUsingResultTransformer() {
  SQLQuery query = session.createSQLQuery(SELECT SOME FANCY DATA);
  /* do other stuff */
  query.setResultTransformer(new
AliasToBeanResultTransformer(YourDTO.class));
  return(query.list());
}

Another alternative would be to iterate the result set yourself 

public ListYourDTO getQueryDoingSelfInstantiation() {
  ListYourDTO myList = new ArrayListYourDTO();
  SQLQuery query = session.createSQLQuery(SELECT SOME FANCY DATA);
  /* do other stuff */
  List results = query.list();
  Iterator i = results.iterator();
  while(i.hasNext())
  {
Object[] row = (Object[]) i.next();
/* each row has a 0-based index for each column of query */
YourDTO dto = new YourDTO();
/* set values on dto */
myList.add(dto);
  }
  return(myList);
}

Both basically do the same; however I find that using the AliasToBean
transformer is much cleaner code :)

Chris

 -Original Message-
 From: Jerson John [mailto:jer...@cprvision.com]
 Sent: Thursday, February 17, 2011 7:43 PM
 To: user@struts.apache.org
 Subject: generate SQL Hibernate Query using session
 
 Hi,
   I am trying to generate SQL query using session.createSQLQuery and
 returning the list object..This select query contains joins and so it
 cannot
 be mapped to any of my model objects.How can I now get the values in
my
 jsp
 page using iterator tag in Struts 2...
 
 Please help me on this
 
 Many Thanks and Regards,
 
 Jerson
 
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



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



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



RE: generate SQL Hibernate Query using session

2011-02-17 Thread Jerson John
Hi,
  Can u suggest me the best way to use datetime picker tag...It seems normal
Struts 2 Tag Library does not have this...

Many Thanks and Regards,

Jerson
CPR Vision Management Pte Ltd
CRM Software  Marketing

E: jer...@cprvision.com
T: + (65) 6535 0996
F: + (65) 6327 8085
www.cprvision.com

CPR Vision - Nominated finalist for CRM, Marketing  Loyalty Agency of the
Year Award - Organized by Marketing Magazine


-Original Message-
From: CRANFORD, CHRIS [mailto:chris.cranf...@setech.com] 
Sent: Friday, February 18, 2011 11:23 AM
To: Struts Users Mailing List
Subject: RE: generate SQL Hibernate Query using session

Jerson -

What I would likely suggest you consider is creating a DTO object that
resembles your result from the SQLQuery.  You can then use one of the
stock Hibernate Transformers to convert the SQL results into instances
of this DTO Bean and then you can return the beans to your view to
iterate over.

Here's a simple example:

public List getQueryUsingResultTransformer() {
  SQLQuery query = session.createSQLQuery(SELECT SOME FANCY DATA);
  /* do other stuff */
  query.setResultTransformer(new
AliasToBeanResultTransformer(YourDTO.class));
  return(query.list());
}

Another alternative would be to iterate the result set yourself 

public ListYourDTO getQueryDoingSelfInstantiation() {
  ListYourDTO myList = new ArrayListYourDTO();
  SQLQuery query = session.createSQLQuery(SELECT SOME FANCY DATA);
  /* do other stuff */
  List results = query.list();
  Iterator i = results.iterator();
  while(i.hasNext())
  {
Object[] row = (Object[]) i.next();
/* each row has a 0-based index for each column of query */
YourDTO dto = new YourDTO();
/* set values on dto */
myList.add(dto);
  }
  return(myList);
}

Both basically do the same; however I find that using the AliasToBean
transformer is much cleaner code :)

Chris

 -Original Message-
 From: Jerson John [mailto:jer...@cprvision.com]
 Sent: Thursday, February 17, 2011 7:43 PM
 To: user@struts.apache.org
 Subject: generate SQL Hibernate Query using session
 
 Hi,
   I am trying to generate SQL query using session.createSQLQuery and
 returning the list object..This select query contains joins and so it
 cannot
 be mapped to any of my model objects.How can I now get the values in
my
 jsp
 page using iterator tag in Struts 2...
 
 Please help me on this
 
 Many Thanks and Regards,
 
 Jerson
 
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



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



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



Re: JSON Error - Hibernate Entities

2011-02-14 Thread Maurizio Cucchiara
Your Item class is a simple POJO [1], isn't it?
 Have you tried to use a DTO [2] object and see what happens?

[1] http://en.wikipedia.org/wiki/Plain_Old_Java_Object
[2] http://martinfowler.com/eaaCatalog/dataTransferObject.html
On 14 February 2011 08:39, CRANFORD, CHRIS chris.cranf...@setech.com wrote:

 Here is the portion from the struts configuration:
 struts-warranty.xml

 action
  name=ajaxWarrantyItemsAcList
  class=com.setech.dw.warranty.web.WarrantyAssignmentItemAjaxAction
  result name=success type=json
    param name=rootitemsList/param/result
  /result
 /action

 The ajax action class looks like this:

 public class WarrantyAssignmentItemAjaxAction extends BaseAction
 {
  private ListItem itemsList;

  public ListItem getItemsList() {
    Return itemsList;
  }

  // other stuff removed from breavity
 }

 I always map the root object to the property I want returned for each
 AJAX call because I have noticed that JSON complains should it try to
 serialize things such as my service objects and so on.

 I did notice that because a few objects within the graph have cyclic
 redundancy that JSONWriter logged a few messages about that before it
 finally puked so I'm not sure if because my object graph has these
 circular references if that is creating problems for it or not.

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Monday, February 14, 2011 1:12 AM
 To: Struts Users Mailing List
 Subject: Re: JSON Error - Hibernate Entities

 Could you post your struts.xml and the action which you're trying to
 serialize?
 I'm pretty sure that your action class contains a reference to a
 connection
 object and the json plugin is trying to serialize it.
 If I'm right you could simply change your root parameter via action
 configuration inside the struts.xml file.

 Maurizio Cucchiara

 Il giorno 14/feb/2011 07.19, CRANFORD, CHRIS
 chris.cranf...@setech.com
 ha scritto:
 I am trying to return a list of hibernate entities to my AJAX call;
 however, I get the following error message when JSONWriter tries to
 serialize the objects.  Can anyone explain why I am getting this error
 and if there is something I can do to avoid it so I can pass my
 objects
 back via a JSON call?

 java.lang.IllegalAccessException: Class
 org.apache.struts2.json.JSONWriter can not access a member of class

 org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrappe
 r
 with modifiers public

 Chris


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


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





-- 
Maurizio Cucchiara

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



RE: JSON Error - Hibernate Entities

2011-02-14 Thread CRANFORD, CHRIS
I eventually decided to write a DTO wrapper that took my POJO as a constructor 
argument and extracted the fields I wanted to pass instead of trying to 
serialize the entire object and that seemed to work.  It just appears that the 
amount of information within the POJO was creating issues for JSON to serialize 
it; however I cannot isolate exactly what is the problem in the POJO.  All of 
the properties in the POJO are serializable :=/.

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Monday, February 14, 2011 2:40 AM
 To: Struts Users Mailing List
 Subject: Re: JSON Error - Hibernate Entities
 
 Your Item class is a simple POJO [1], isn't it?
  Have you tried to use a DTO [2] object and see what happens?
 
 [1] http://en.wikipedia.org/wiki/Plain_Old_Java_Object
 [2] http://martinfowler.com/eaaCatalog/dataTransferObject.html
 On 14 February 2011 08:39, CRANFORD, CHRIS chris.cranf...@setech.com
 wrote:
 
  Here is the portion from the struts configuration:
  struts-warranty.xml
 
  action
   name=ajaxWarrantyItemsAcList
   class=com.setech.dw.warranty.web.WarrantyAssignmentItemAjaxAction
   result name=success type=json
     param name=rootitemsList/param/result
   /result
  /action
 
  The ajax action class looks like this:
 
  public class WarrantyAssignmentItemAjaxAction extends BaseAction
  {
   private ListItem itemsList;
 
   public ListItem getItemsList() {
     Return itemsList;
   }
 
   // other stuff removed from breavity
  }
 
  I always map the root object to the property I want returned for each
  AJAX call because I have noticed that JSON complains should it try to
  serialize things such as my service objects and so on.
 
  I did notice that because a few objects within the graph have cyclic
  redundancy that JSONWriter logged a few messages about that before it
  finally puked so I'm not sure if because my object graph has these
  circular references if that is creating problems for it or not.
 
  -Original Message-
  From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
  Sent: Monday, February 14, 2011 1:12 AM
  To: Struts Users Mailing List
  Subject: Re: JSON Error - Hibernate Entities
 
  Could you post your struts.xml and the action which you're trying to
  serialize?
  I'm pretty sure that your action class contains a reference to a
  connection
  object and the json plugin is trying to serialize it.
  If I'm right you could simply change your root parameter via action
  configuration inside the struts.xml file.
 
  Maurizio Cucchiara
 
  Il giorno 14/feb/2011 07.19, CRANFORD, CHRIS
  chris.cranf...@setech.com
  ha scritto:
  I am trying to return a list of hibernate entities to my AJAX call;
  however, I get the following error message when JSONWriter tries to
  serialize the objects.  Can anyone explain why I am getting this
 error
  and if there is something I can do to avoid it so I can pass my
  objects
  back via a JSON call?
 
  java.lang.IllegalAccessException: Class
  org.apache.struts2.json.JSONWriter can not access a member of class
 
 
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrappe
  r
  with modifiers public
 
  Chris
 
 
  
 -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 
 --
 Maurizio Cucchiara
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



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



Re: RE: JSON Error - Hibernate Entities

2011-02-14 Thread Maurizio Cucchiara
My guess is that the json plugin was navigating the entire graph object,
trying to serialize the entire java world.

Maurizio Cucchiara

Il giorno 14/feb/2011 14.12, CRANFORD, CHRIS chris.cranf...@setech.com
ha scritto:
 I eventually decided to write a DTO wrapper that took my POJO as a
constructor argument and extracted the fields I wanted to pass instead of
trying to serialize the entire object and that seemed to work. It just
appears that the amount of information within the POJO was creating issues
for JSON to serialize it; however I cannot isolate exactly what is the
problem in the POJO. All of the properties in the POJO are serializable :=/.

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Monday, February 14, 2011 2:40 AM
 To: Struts Users Mailing List
 Subject: Re: JSON Error - Hibernate Entities

 Your Item class is a simple POJO [1], isn't it?
 Have you tried to use a DTO [2] object and see what happens?

 [1] http://en.wikipedia.org/wiki/Plain_Old_Java_Object
 [2] http://martinfowler.com/eaaCatalog/dataTransferObject.html
 On 14 February 2011 08:39, CRANFORD, CHRIS chris.cranf...@setech.com
 wrote:
 
  Here is the portion from the struts configuration:
  struts-warranty.xml
 
  action
   name=ajaxWarrantyItemsAcList
   class=com.setech.dw.warranty.web.WarrantyAssignmentItemAjaxAction
   result name=success type=json
 param name=rootitemsList/param/result
   /result
  /action
 
  The ajax action class looks like this:
 
  public class WarrantyAssignmentItemAjaxAction extends BaseAction
  {
   private ListItem itemsList;
 
   public ListItem getItemsList() {
 Return itemsList;
   }
 
   // other stuff removed from breavity
  }
 
  I always map the root object to the property I want returned for each
  AJAX call because I have noticed that JSON complains should it try to
  serialize things such as my service objects and so on.
 
  I did notice that because a few objects within the graph have cyclic
  redundancy that JSONWriter logged a few messages about that before it
  finally puked so I'm not sure if because my object graph has these
  circular references if that is creating problems for it or not.
 
  -Original Message-
  From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
  Sent: Monday, February 14, 2011 1:12 AM
  To: Struts Users Mailing List
  Subject: Re: JSON Error - Hibernate Entities
 
  Could you post your struts.xml and the action which you're trying to
  serialize?
  I'm pretty sure that your action class contains a reference to a
  connection
  object and the json plugin is trying to serialize it.
  If I'm right you could simply change your root parameter via action
  configuration inside the struts.xml file.
 
  Maurizio Cucchiara
 
  Il giorno 14/feb/2011 07.19, CRANFORD, CHRIS
  chris.cranf...@setech.com
  ha scritto:
  I am trying to return a list of hibernate entities to my AJAX call;
  however, I get the following error message when JSONWriter tries to
  serialize the objects.  Can anyone explain why I am getting this
 error
  and if there is something I can do to avoid it so I can pass my
  objects
  back via a JSON call?
 
  java.lang.IllegalAccessException: Class
  org.apache.struts2.json.JSONWriter can not access a member of class
 
 
 org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrappe
  r
  with modifiers public
 
  Chris
 
 
  
 -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 



 --
 Maurizio Cucchiara

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




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



JSON Error - Hibernate Entities

2011-02-13 Thread CRANFORD, CHRIS
I am trying to return a list of hibernate entities to my AJAX call;
however, I get the following error message when JSONWriter tries to
serialize the objects.  Can anyone explain why I am getting this error
and if there is something I can do to avoid it so I can pass my objects
back via a JSON call?

java.lang.IllegalAccessException: Class
org.apache.struts2.json.JSONWriter can not access a member of class
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
with modifiers public

Chris


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



Re: JSON Error - Hibernate Entities

2011-02-13 Thread Maurizio Cucchiara
Could you post your struts.xml and the action which you're trying to
serialize?
I'm pretty sure that your action class contains a reference to a connection
object and the json plugin is trying to serialize it.
If I'm right you could simply change your root parameter via action
configuration inside the struts.xml file.

Maurizio Cucchiara

Il giorno 14/feb/2011 07.19, CRANFORD, CHRIS chris.cranf...@setech.com
ha scritto:
I am trying to return a list of hibernate entities to my AJAX call;
however, I get the following error message when JSONWriter tries to
serialize the objects.  Can anyone explain why I am getting this error
and if there is something I can do to avoid it so I can pass my objects
back via a JSON call?

java.lang.IllegalAccessException: Class
org.apache.struts2.json.JSONWriter can not access a member of class
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
with modifiers public

Chris


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


RE: JSON Error - Hibernate Entities

2011-02-13 Thread CRANFORD, CHRIS

Here is the portion from the struts configuration:
struts-warranty.xml

action 
  name=ajaxWarrantyItemsAcList
  class=com.setech.dw.warranty.web.WarrantyAssignmentItemAjaxAction
  result name=success type=json
param name=rootitemsList/param/result
  /result
/action

The ajax action class looks like this:

public class WarrantyAssignmentItemAjaxAction extends BaseAction
{
  private ListItem itemsList;
  
  public ListItem getItemsList() {
Return itemsList;
  }

  // other stuff removed from breavity
}

I always map the root object to the property I want returned for each
AJAX call because I have noticed that JSON complains should it try to
serialize things such as my service objects and so on. 

I did notice that because a few objects within the graph have cyclic
redundancy that JSONWriter logged a few messages about that before it
finally puked so I'm not sure if because my object graph has these
circular references if that is creating problems for it or not.

 -Original Message-
 From: Maurizio Cucchiara [mailto:maurizio.cucchi...@gmail.com]
 Sent: Monday, February 14, 2011 1:12 AM
 To: Struts Users Mailing List
 Subject: Re: JSON Error - Hibernate Entities
 
 Could you post your struts.xml and the action which you're trying to
 serialize?
 I'm pretty sure that your action class contains a reference to a
 connection
 object and the json plugin is trying to serialize it.
 If I'm right you could simply change your root parameter via action
 configuration inside the struts.xml file.
 
 Maurizio Cucchiara
 
 Il giorno 14/feb/2011 07.19, CRANFORD, CHRIS
 chris.cranf...@setech.com
 ha scritto:
 I am trying to return a list of hibernate entities to my AJAX call;
 however, I get the following error message when JSONWriter tries to
 serialize the objects.  Can anyone explain why I am getting this error
 and if there is something I can do to avoid it so I can pass my
objects
 back via a JSON call?
 
 java.lang.IllegalAccessException: Class
 org.apache.struts2.json.JSONWriter can not access a member of class

org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrappe
 r
 with modifiers public
 
 Chris
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


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



error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread abhishek jain
hi,
I am running a simple search of a product via Hibernate on struts code,
the code runs fine when i run via a function in public static void main

when i run the same code via struts i get the following exception,
the code is:

public static void main(String[] args) {
ProductsDAO pd = new ProductsDAO();
ListProducts l = pd.findByPUrlcomponent(ABC);
Products pr = l.get(0);
System.out.println(pr.getPId().toString());
}
Pl. advice i am using myeclipse,

the exception is

java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)

org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)

org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)

org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)

org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)

org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)

org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)

org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)

org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)

org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)

org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)

org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)

org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:101)
org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:80)

org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)

org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)

org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
com.eggbods.hibernate.ProductsDAO.findByProperty(ProductsDAO.java:143)

com.eggbods.hibernate.ProductsDAO.findByPUrlcomponent(ProductsDAO.java:299)
com.eggbods.struts.action.ProductsAction.product(ProductsAction.java:42)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)

com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)

com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)

com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)

org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

org.apache.struts2

Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread Dave Newton
Chances are you're not running using the same classpath.

Dave

On Sat, Feb 12, 2011 at 8:20 AM, abhishek jain
abhishek.netj...@gmail.com wrote:
 hi,
 I am running a simple search of a product via Hibernate on struts code,
 the code runs fine when i run via a function in public static void main

 when i run the same code via struts i get the following exception,
 the code is:

 public static void main(String[] args) {
        ProductsDAO pd = new ProductsDAO();
        ListProducts l = pd.findByPUrlcomponent(ABC);
        Products pr = l.get(0);
        System.out.println(pr.getPId().toString());
    }
 Pl. advice i am using myeclipse,

 the exception is

 java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
        
 org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
        
 org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
        
 org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
        
 org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
        
 org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
        org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:101)
        org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:80)
        
 org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
        
 org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
        
 org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
        org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
        com.eggbods.hibernate.ProductsDAO.findByProperty(ProductsDAO.java:143)
        
 com.eggbods.hibernate.ProductsDAO.findByPUrlcomponent(ProductsDAO.java:299)
        
 com.eggbods.struts.action.ProductsAction.product(ProductsAction.java:42)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:597)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
        
 com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
        
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
 com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
        
 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
 com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
 com.opensymphony.xwork2

Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread Maurizio Cucchiara
It looks like there something wrong in your dependencies. Check your
classpath (I'm not sure, but at first glance it'd seem the antlr library
version).
I could be proprably wrong but it not seems a struts problem.

Maurizio Cucchiara

Il giorno 12/feb/2011 14.20, abhishek jain abhishek.netj...@gmail.com ha
scritto:
 hi,
 I am running a simple search of a product via Hibernate on struts code,
 the code runs fine when i run via a function in public static void main

 when i run the same code via struts i get the following exception,
 the code is:

 public static void main(String[] args) {
 ProductsDAO pd = new ProductsDAO();
 ListProducts l = pd.findByPUrlcomponent(ABC);
 Products pr = l.get(0);
 System.out.println(pr.getPId().toString());
 }
 Pl. advice i am using myeclipse,

 the exception is

 java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)

org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
 org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)

org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)

org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)

org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)

org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
 org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)

org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)

org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)

org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)

org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)

org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
 org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:101)
 org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:80)

org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)

org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)

org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
 org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
 com.eggbods.hibernate.ProductsDAO.findByProperty(ProductsDAO.java:143)

com.eggbods.hibernate.ProductsDAO.findByPUrlcomponent(ProductsDAO.java:299)
 com.eggbods.struts.action.ProductsAction.product(ProductsAction.java:42)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)

com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)

com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)

com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)

org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75

Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread abhishek jain
hi,
I am using myeclipse , and using its own default classpath.
I have two antlr-2.7.2.jar in Struts core libraries and antlr-2.7.6.jar in
hibernate core libraries.

I tried removing antlr-2.7.2.jar  and still the problem persists.

thanks
abhishek


On Sat, Feb 12, 2011 at 7:05 PM, Maurizio Cucchiara 
maurizio.cucchi...@gmail.com wrote:

 It looks like there something wrong in your dependencies. Check your
 classpath (I'm not sure, but at first glance it'd seem the antlr library
 version).
 I could be proprably wrong but it not seems a struts problem.

 Maurizio Cucchiara

 Il giorno 12/feb/2011 14.20, abhishek jain abhishek.netj...@gmail.com
 ha
 scritto:
  hi,
  I am running a simple search of a product via Hibernate on struts code,
  the code runs fine when i run via a function in public static void main
 
  when i run the same code via struts i get the following exception,
  the code is:
 
  public static void main(String[] args) {
  ProductsDAO pd = new ProductsDAO();
  ListProducts l = pd.findByPUrlcomponent(ABC);
  Products pr = l.get(0);
  System.out.println(pr.getPId().toString());
  }
  Pl. advice i am using myeclipse,
 
  the exception is
 
  java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
 

 org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
  org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
  org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
 

 org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
 

 org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
 

 org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
  org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:101)
  org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:80)
 

 org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
 

 org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
 

 org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
  org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
  com.eggbods.hibernate.ProductsDAO.findByProperty(ProductsDAO.java:143)
 
 com.eggbods.hibernate.ProductsDAO.findByPUrlcomponent(ProductsDAO.java:299)
  com.eggbods.struts.action.ProductsAction.product(ProductsAction.java:42)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 

 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 

 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
 

 com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
 

 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
 

 com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
 

 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
 

 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
 

 com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
 

 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
 

 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
 

 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195

Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread Dave Newton
You need to determine which versions you're actually depending on.

Are you attempting to do dependency management manually?!

Dave


On Sat, Feb 12, 2011 at 9:32 AM, abhishek jain
abhishek.netj...@gmail.com wrote:
 hi,
 I am using myeclipse , and using its own default classpath.
 I have two antlr-2.7.2.jar in Struts core libraries and antlr-2.7.6.jar in
 hibernate core libraries.

 I tried removing antlr-2.7.2.jar  and still the problem persists.

 thanks
 abhishek


 On Sat, Feb 12, 2011 at 7:05 PM, Maurizio Cucchiara 
 maurizio.cucchi...@gmail.com wrote:

 It looks like there something wrong in your dependencies. Check your
 classpath (I'm not sure, but at first glance it'd seem the antlr library
 version).
 I could be proprably wrong but it not seems a struts problem.

 Maurizio Cucchiara

 Il giorno 12/feb/2011 14.20, abhishek jain abhishek.netj...@gmail.com
 ha
 scritto:
  hi,
  I am running a simple search of a product via Hibernate on struts code,
  the code runs fine when i run via a function in public static void main
 
  when i run the same code via struts i get the following exception,
  the code is:
 
  public static void main(String[] args) {
  ProductsDAO pd = new ProductsDAO();
  ListProducts l = pd.findByPUrlcomponent(ABC);
  Products pr = l.get(0);
  System.out.println(pr.getPId().toString());
  }
  Pl. advice i am using myeclipse,
 
  the exception is
 
  java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
 

 org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
  org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
  org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
 

 org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
 

 org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
 

 org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
 

 org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
  org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:101)
  org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:80)
 

 org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
 

 org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
 

 org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
  org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
  com.eggbods.hibernate.ProductsDAO.findByProperty(ProductsDAO.java:143)
 
 com.eggbods.hibernate.ProductsDAO.findByPUrlcomponent(ProductsDAO.java:299)
  com.eggbods.struts.action.ProductsAction.product(ProductsAction.java:42)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 

 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 

 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
 

 com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
 

 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
 

 com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
 

 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
 

 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
 

 com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
 

 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
 

 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
 

 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87

Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread abhishek jain
no, i am not that experienced in java to do dependency management manually,
i just tried removing the library after the probelm just in case it solved

thanks
abhi

On Sat, Feb 12, 2011 at 8:06 PM, Dave Newton davelnew...@gmail.com wrote:

 You need to determine which versions you're actually depending on.

 Are you attempting to do dependency management manually?!

 Dave


 On Sat, Feb 12, 2011 at 9:32 AM, abhishek jain
 abhishek.netj...@gmail.com wrote:
  hi,
  I am using myeclipse , and using its own default classpath.
  I have two antlr-2.7.2.jar in Struts core libraries and antlr-2.7.6.jar
 in
  hibernate core libraries.
 
  I tried removing antlr-2.7.2.jar  and still the problem persists.
 
  thanks
  abhishek
 
 
  On Sat, Feb 12, 2011 at 7:05 PM, Maurizio Cucchiara 
  maurizio.cucchi...@gmail.com wrote:
 
  It looks like there something wrong in your dependencies. Check your
  classpath (I'm not sure, but at first glance it'd seem the antlr library
  version).
  I could be proprably wrong but it not seems a struts problem.
 
  Maurizio Cucchiara
 
  Il giorno 12/feb/2011 14.20, abhishek jain 
 abhishek.netj...@gmail.com
  ha
  scritto:
   hi,
   I am running a simple search of a product via Hibernate on struts
 code,
   the code runs fine when i run via a function in public static void
 main
  
   when i run the same code via struts i get the following exception,
   the code is:
  
   public static void main(String[] args) {
   ProductsDAO pd = new ProductsDAO();
   ListProducts l = pd.findByPUrlcomponent(ABC);
   Products pr = l.get(0);
   System.out.println(pr.getPId().toString());
   }
   Pl. advice i am using myeclipse,
  
   the exception is
  
   java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
  
 
 
 org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)
  
 
 
 org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
  
 org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)
  
 
 
 org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)
  
 
 
 org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)
  
 
 
 org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
  
 
 
 org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
  
 org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
  
 
 
 org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
  
 
 
 org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
  
 
 
 org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
  
 
 
 org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
  
 
 
 org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
   org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:101)
   org.hibernate.engine.query.HQLQueryPlan.init(HQLQueryPlan.java:80)
  
 
 
 org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
  
 
 
 org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
  
 
 
 org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
   org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
   com.eggbods.hibernate.ProductsDAO.findByProperty(ProductsDAO.java:143)
  
 
 com.eggbods.hibernate.ProductsDAO.findByPUrlcomponent(ProductsDAO.java:299)
  
 com.eggbods.struts.action.ProductsAction.product(ProductsAction.java:42)
   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
  
 
 
 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
  
 
 
 com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
  
 
 
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
  
 
 
 com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
  
 
 
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  
 
 
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  
 
 
 com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
  
 
 
 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
  
 
 
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  
 
 
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237

Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread Dave Newton
On Sat, Feb 12, 2011 at 9:39 AM, abhishek jain
abhishek.netj...@gmail.com wrote:
 no, i am not that experienced in java to do dependency management manually,
 i just tried removing the library after the probelm just in case it solved

How are you doing dependency management?

Dave

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



Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread abhishek jain
On Sat, Feb 12, 2011 at 8:12 PM, Dave Newton davelnew...@gmail.com wrote:

 On Sat, Feb 12, 2011 at 9:39 AM, abhishek jain
 abhishek.netj...@gmail.com wrote:
  no, i am not that experienced in java to do dependency management
 manually,
  i just tried removing the library after the probelm just in case it
 solved

 How are you doing dependency management?

 hi,
I am not doing any dependency management, i am just relying on myeclipse,
what is the best way,
Pl. clear my doubts,
thanks
abhi


Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread Dave Newton
On Sat, Feb 12, 2011 at 10:58 AM, abhishek jain
abhishek.netj...@gmail.com wrote:
 I am not doing any dependency management, i am just relying on myeclipse,
 what is the best way,

I'm not sure; I haven't used MyEclipse in some time (but I did for
quite awhile; very often worth the (minimal) cost.

I would strongly pursue the library conflict idea people have
mentioned--perhaps you could ask for support from MyEclipse in
determining how to configure it to avoid the conflict, or at least
they could point you in the right direction if it's not an issue
directly related to MyEclipse.

Do you know if you're working with a Maven-based project or not?

Dave

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



Re: error while running code of struts2.x and hibernate 3.3: java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I

2011-02-12 Thread abhishek jain
On Sat, Feb 12, 2011 at 9:47 PM, Dave Newton davelnew...@gmail.com wrote:

 On Sat, Feb 12, 2011 at 10:58 AM, abhishek jain
 abhishek.netj...@gmail.com wrote:
  I am not doing any dependency management, i am just relying on myeclipse,
  what is the best way,

 I'm not sure; I haven't used MyEclipse in some time (but I did for
 quite awhile; very often worth the (minimal) cost.

 I would strongly pursue the library conflict idea people have
 mentioned--perhaps you could ask for support from MyEclipse in
 determining how to configure it to avoid the conflict, or at least
 they could point you in the right direction if it's not an issue
 directly related to MyEclipse.

 Do you know if you're working with a Maven-based project or not?

 Dave


no, i am not using Maven based project,
Also the problem solved when i now used the latest version of antlr jar file
thanks for helping

abhishek


Decent tutorial or working example of Hibernate 3 + Struts 2 + Tiles 2 on myeclipse

2011-02-10 Thread abhishek jain
Hi,
Can anyone forward me to a good  tutorial or a working example of Hibernate
3 + Struts 2 + Tiles 2 on myeclipse. Maybe a project i can import in
myeclipse or so,
any simple skeleton will do,

I tried my hand directly but cannt get through i get some exceptions
everytime i add struts and hibernate with tiles capabilities in myeclipse. I
think some libraries default in Myeclipse are conflicting each other .

thanks
-- 
Thanks and kind Regards,
Abhishek jain


RE: Decent tutorial or working example of Hibernate 3 + Struts 2 + Tiles 2 on myeclipse

2011-02-10 Thread adam pinder


make sure you only add additional jars into the web app itself and avoid 
(mostly) adding jars into common library folders.
i use struts2 and hibernate3 but not tiles and have no problems like yours.
adam

 Date: Thu, 10 Feb 2011 14:53:52 +0530
 Subject: Decent tutorial or working example of Hibernate 3 + Struts 2 + Tiles 
 2 on myeclipse
 From: abhishek.netj...@gmail.com
 To: user@struts.apache.org
 
 Hi,
 Can anyone forward me to a good  tutorial or a working example of Hibernate
 3 + Struts 2 + Tiles 2 on myeclipse. Maybe a project i can import in
 myeclipse or so,
 any simple skeleton will do,
 
 I tried my hand directly but cannt get through i get some exceptions
 everytime i add struts and hibernate with tiles capabilities in myeclipse. I
 think some libraries default in Myeclipse are conflicting each other .
 
 thanks
 -- 
 Thanks and kind Regards,
 Abhishek jain
  

  1   2   3   4   5   6   7   8   9   >