Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-19-2007, 07:13 PM
Member
 
Join Date: Jul 2007
Posts: 2
scastro is on a distinguished road
Hibernate 2.1.8 / Oracle 10 / Tomcat 5.0.28 : Data not retrieved from the database
Dear all,
Here is my problem:

I was using hibernate 2.1.8 with Oracle 8, and TomCat - Spring for showing data from a db.
I have changed to Oracle 10, and there are no errors at all, but the data is not retrieved.
I am using the correct Dialect (Oracle9Dialect) I guess, and the driver for Oracle 10 (ojdbc14-10.2.0.3.0.jar)

The funny thing is that testing the code without TomCat, gives correct results, but when running it under TomCat, the data is not there (returns null or 0).

Any clue in this?
Thanks in advance,
Cheers,
Silvia
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-20-2007, 01:10 AM
Member
 
Join Date: Jul 2007
Posts: 41
oregon is on a distinguished road
It's very strange
It gives to you an error or something like that?
can you paste the code?
Did you try to re-install the tomcat?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-20-2007, 12:20 PM
Member
 
Join Date: Jul 2007
Posts: 2
scastro is on a distinguished road
Dear Oregon,
Thanks for your reply.

I haven't reinstall Tomcat, because it didn't work in operations environment, so I installed it in my machine, in order to investigate. Tomcat is ok.

Here is the code:

1. The java code:

Code:
public class CurrentPropController extends MultiActionRevolutionController { //private static final Log log = LogFactory.getLog(CurrentPropController.class.getName()); /** Retrieves the current proposals * @param request * @param response * @return Model and view * @throws ServletException */ public ModelAndView currentProp(HttpServletRequest request, HttpServletResponse response) { Session session = getSession(); // Get the AO parameter from the request, default to AO1 if the parameter is invalid String ao = "5"; try { Integer.parseInt(request.getParameter("ao")); ao = request.getParameter("ao"); logger.info("ao parameter: '" + request.getParameter("ao") + "'"); } catch (NumberFormatException e) { logger.warn("Invalid ao parameter: '" + request.getParameter("ao") + "'"); } try { // Load the proposal Map model = BaseAbstractProposalDAO.getInstance().proposalCount(ao, session); logger.info("map created with proposalCount openTime: '" + model.get("openTime") + "'"); // Create a model and return it together with the view name return new ModelAndView("currentPropView","model", model); } catch (ObjectNotFoundException e) { logger.warn("Object Not Found: '" + request.getParameter("ao") + "'", e); return createExceptionModelAndView(e, "AO '" + ao + "' could not be found"); } catch (HibernateException e) { logger.warn("HibernateException: '" + request.getParameter("ao") + "'", e); return createExceptionModelAndView(e, "Unexpected error while loading proposal '" + ao + "'"); } } } public class AbstractProposalDAO extends BaseAbstractProposalDAO { /** * Executes the counting query: * <pre><code> * "SELECT count(p.id) from prop p where "+ whereClause * </code></pre> * using Session s and returns the retreived count as an integer * @param whereClause * @param s * @return * @throws HibernateException */ public Integer proposalCountForCondition(String whereClause, Session s) throws HibernateException { List l = find("select count(p.id) from " + AbstractProposal.class.getName() + " p" +" where "+ whereClause, s); Integer openTime = null; if (l!=null && l.size() == 1) { openTime = (Integer)l.get(0); } return openTime; } /** * Constructing a map with AO statistics, keys are * openTime, keyProgrammes, subscriptionsTotal and the Key Programme * IDs ('0531000' maps to the number of subscriptions to that KP). * * @param AO * @param s * @return * @throws HibernateException */ public Map proposalCount(String AO, Session s) throws HibernateException { Integer openTime = proposalCountForCondition("p.id like '"+AO+"2%'", s); Integer subscriptions = proposalCountForCondition("p.id like '"+AO+"3%' and not(p.id like '%000')", s); Integer keyProgrammes = proposalCountForCondition("p.id like '"+AO+"3_000'", s); Map map = new HashMap(); map.put("openTime", openTime); map.put("subscriptionsTotal", subscriptions); map.put("keyProgrammes", keyProgrammes); for (int k=0; k < keyProgrammes.intValue(); k++) { Integer toThisKP = proposalCountForCondition("p.id like '"+AO+"3"+k+"%' and not(p.id like '%000')", s); map.put(AO+"3"+k+"000", toThisKP); } return map; }
This code is ok when running it as a test unit, (without tomcat), because I can see the trace: "map created with proposalCount openTime: '99"

But when running it with Tomcat, the log is "map created with proposalCount openTime: 0"

If I use, another db (oracle 8) then is working again.
????

Thanks again,
Silvia

Last edited by JavaBean : 07-20-2007 at 12:24 PM. Reason: Code placed inside [code] tag.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-20-2007, 12:23 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Silvia,

I placed your code inside [code] tags. Please use it next time since it makes your code more readable!
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-10-2007, 12:41 AM
Member
 
Join Date: Jul 2007
Posts: 43
leonard is on a distinguished road
Did you try uninstall tomcat and reinstall it?
It sounds silly but It often works
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using JDBC to connect to ORACLE database Java Tip Java Tips 0 02-10-2008 01:27 PM
How can I store an image to the database using hibernate cryss_tyna Database 0 08-15-2007 03:48 PM
problem with hibernate and oracle 8i javadev Database 4 08-09-2007 04:21 PM
can hibernate work with Oracle 10g javadev Database 4 07-08-2007 10:47 PM
Hibernate with multiple database Marty Database 2 05-07-2007 06:56 PM


All times are GMT +3. The time now is 01:32 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org