2 Replies Latest reply on Dec 10, 2009 2:35 AM by jaikiran

    Weird generated SQL with JBoss 5.1

    patrick1

      Hi,

      I am trying to migrate my ejb3 app from JBoss 4.2.3 to JBoss 5.1
      I get a strange hibernate related issue when trying to perfrom an native query with JBoss 5.1 :

      String nativeQuery = "select sysdate from dual";
      Query query = getEntityManager().createNativeQuery(nativeQuery);


      When I execute this code withing JBoss 5.1 I get the following in the console :

      12:09:22,833 INFO [STDOUT] Hibernate: select * from (select sysdate from dual ) where rownum <= ?

      This used to work perfectly inside JBoss 4.2.3 so I wonder what I need to do ???

      Any ideas?

      - Patrick

        • 1. Re: Weird generated SQL with JBoss 5.1
          patrick1

          I did a little more research on the pbm I have :

          To be a little more specific I am wondering how to disable the Oracle dialect related paging behavior ? When using the EntityManager to execute a native query it seems that Hibernate thinks that a paging type query is to be executed...

          Is there maybe a property I need to set in the persistence.xml to disable the paging behavior for native query?

          • 2. Re: Weird generated SQL with JBoss 5.1
            jaikiran

            You might have better luck asking this in the Hibernate user forum https://forum.hibernate.org/viewforum.php?f=1.

            Also, try specifying the return type of the query result:

            getEntityManager().createNativeQuery(nativeQuery, Date.class);


            I don't know if that's going to make a difference though.