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: Procedure Doesnt Exist
PostPosted: Wed Aug 09, 2006 10:13 pm 
Beginner
Beginner

Joined: Wed Mar 01, 2006 11:26 pm
Posts: 23
3.1.3


Hi there I have a very annoying problem here.

I am trying to execute a select statement against our db (this sql works) however when add to it to a mapped named query and try to execute it through hibernate I get an error telling me that a Procedure doesnt exist. (See the SQL error)

Throughout our application I execute queries using the exact same way without any other problems.

Does anyone have any ideas on this? Is there an problem with the SQL? Is it written ina format that hibernate understands?

Thanks

Chris




<sql-query name="Events_Flat" callable="true">
<return alias="i" class="Event">
<return-property name="ipApp" column="tt.TransactionTypeID" />
</return>
<![CDATA[SELECT i.IPAppID ip_applications i INNER JOIN opportunities t ON i.IPAppID = t.IPAppID INNER JOIN transaction_types tt ON t.OppType = tt.TransactionTypeID INNER JOIN opp_prod_countries tc ON t.OppID = tc.OppID INNER JOIN pct_countries pc ON
tc.ProductID = pc.ProductI AND tc.CountryID = pc.CountryID INNER JOIN countries c ON pc.CountryID = c.CountryID INNER JOIN events e ON tc.ProductID = e.ProductID AND tc.CountryID = e.CountryID INNER JOIN event_types et ON e.EventTypeID =
et.EventTypeID]]>
</sql-query>




Query query = session.getNamedQuery("Events_Flat");
query.list


SQL Error: 1305, SQLState: 42000
- PROCEDURE IPAppID does not exist


MySQL 5.0


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 10, 2006 8:26 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
You forgot FROM keyword.

It should be something like:
Code:
<sql-query name="Events_Flat" callable="true">
   <return alias="i" class="Event">
      <return-property name="ipApp" column="tt.TransactionTypeID" />
   </return>
   <![CDATA[
      SELECT
         i.IPAppID
      FROM
         ip_applications i
         INNER JOIN opportunities t
            ON i.IPAppID = t.IPAppID
         INNER JOIN transaction_types tt
            ON t.OppType = tt.TransactionTypeID
         INNER JOIN opp_prod_countries tc
            ON t.OppID = tc.OppID
         INNER JOIN pct_countries pc
            ON tc.ProductID = pc.ProductI AND tc.CountryID = pc.CountryID
         INNER JOIN countries c
            ON pc.CountryID = c.CountryID
         INNER JOIN events e
            ON tc.ProductID = e.ProductID AND tc.CountryID = e.CountryID
         INNER JOIN event_types et
            ON e.EventTypeID = et.EventTypeID
   ]]>
</sql-query>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 10, 2006 8:36 pm 
Beginner
Beginner

Joined: Wed Mar 01, 2006 11:26 pm
Posts: 23
Thanks for the reply. Yeah the example I gave you was a bit rubbish in that it had an error in the sql. I think that was just because of me playing around and not reverting back to the correct sql. Sorry about that.

The problem is actually solved by removing the 'callable=true' from the query tag. I think this is reserved for stored procedure calls only.

Thanks

Chris


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.