-->
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.  [ 1 post ] 
Author Message
 Post subject: ArrayStoreException getResultList() on stored procedure call
PostPosted: Tue Jun 15, 2010 1:38 pm 
Newbie

Joined: Tue Jun 01, 2010 12:34 pm
Posts: 2
I realize this has been asked before, but I can't seem to find an answer and I've been looking all day. I have the following unit test which always seems to throw an ArrayStoreException when calling the getResultList() method on my query.

Code:
@Entity
@RooEntity
@NamedNativeQuery(name="Mileage.calculateMileage",
      query = "{ call logobj.milookup(?,?,?) }",
      hints = {
         @QueryHint(name = "org.hibernate.callable", value = "true"),
         @QueryHint(name = "org.hibernate.readOnly", value = "true")
      },
      resultClass = MileageTest.class)
public class MileageTest {
   private static Log log = LogFactory.getLog(MileageTest.class);
   
   @Column(name = "PMMILES")
   private String miles;

   @Test
   public void calculateMileage() {
      Map<String,String> args = new HashMap<String,String>();
                // args values are set here.
      
      EntityManagerFactory emf = Persistence.createEntityManagerFactory("persistenceUnit", args);
      EntityManager em = emf.createEntityManager();
      
      Query query = em.createNamedQuery("Mileage.calculateMileage");
      
      query.setParameter(2, "TORONTO                       ON");
      query.setParameter(3, "MONTREAL                      QC");
      
      if(log.isInfoEnabled())
         log.info(query.getResultList());
   }
}


My stored procedure has 3 parameters. The first is an OUT parameter and the rest are IN parameters. The procedure takes the 2 IN parameters which are cities, calculates the miles between then and returns the result in the OUT parameter.

Anybody know why it keeps throwing this exception? I've tried switching between a Hibernate NamedNativeQuery and a JPA NamedNativeQuery, but I always get the same exception.


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

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.