2 Replies Latest reply on Nov 25, 2005 4:46 AM by Emmanuel Bernard


    M Crenshaw Newbie


      I?m trying to access an Oracle DB table dual to get the next sequence value.
      I?m executing the following code and I?m getting: java.lang.RuntimeException: NOT YET IMPLEMENTED

      Query testQuery = (Query)em.createNativeQuery("select SEQ_test.nextval from dual");

      // testQuery.executeUpdate();
      Integer testval = (Integer)testQuery.getSingleResult();

      We are running out Unit Tests via JUNIT/jboss-EJB-3.0_Embeddable_ALPHA.

      Two questions
      1) Am I using the correct method to execute a select from dual?

      2) If I?m using the correct method, and this is not implemented in the version I?m running, is there a more current version? Or is there any timeline on when this functionality will be available?

      Thanks for your assistance!

        • 1. Re: createNativeQuery(
          Thomas Orr Newbie

          I take it your query returns a scalar? That is not yet implemented. I've seen it around in various docs that it will be in the future. The workaround is to map the result set to an entity and use the property of the entity to access the scalar. Atleast, this is how I did it. You could generalize this into a wrapper for int that has a set{ColumnName} method that you then map to the scalar. A lot of work, but maybe better than mapping an entire entity.

          • 2. Re: createNativeQuery(
            Emmanuel Bernard Master

            the other solution would be to access the underlying conection by doing
            ( ( HibernateEntityManager) em).getSession().connection()