-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: HB runs ok in standalone java application, but not in Struts
PostPosted: Thu Jun 05, 2008 1:11 am 
Newbie

Joined: Thu Jun 05, 2008 12:59 am
Posts: 1
Dear All,

I have the following code to read data from database through the Struts. The web page is up and running good but I find problems in displaying the data.

Whenever changes are made to the database, the changes are not reflected on the webpage, so I write a few lines of code to test the HB config and connection, it's fine while running in standalone java application that shows the actual number of returned records.

It seems that the struts caches / always uses the same DAO instance or something else. Please help and thank you very much.


public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {

ItemsDAO itemsDAO = new ItemsDAO();
System.out.println(itemsDAO.findAll().size());
return mapping.findForward("success");
}

public static void main(String[] argv) {
ItemsDAO itemsDAO = new ItemsDAO();
System.out.println(itemsDAO.findAll().size());
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 4:16 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
i don't know if this will help you or if i'm right but as i know struts 1 actions will be instantiated once and handle all requests for this action maybe it has something to do with it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 11:46 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
I'd like to know how you are performing transaction demarcation, and whether or not Struts is caching any information. That could be key.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.