-->
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: Problem reading next value on a DB2 UDB sequence
PostPosted: Mon Jan 31, 2011 6:58 am 
Newbie

Joined: Mon Nov 30, 2009 2:19 pm
Posts: 7
Hello,

I have got Problems reading the next value on a sequence from a DB2 UDB for iSeries Database with Hibernate as JPA Provider:

Code:
Query nextvalQuery = em
                .createNativeQuery("SELECT NEXTVAL FOR schemaname.sequencename"
                        + " FROM SYSIBM.SYSDUMMY1");

        Object snr = nextvalQuery.getSingleResult();


Code:
Hibernate:
    select
        *
    from
        ( select
            rownumber() over() as rownumber_,
            NEXTVAL FOR schemaname.sequencename
        FROM
            SYSIBM.SYSDUMMY1 ) as temp_
    where
        rownumber_ <= ?
2011-01-31 11:43:34,460 WARN  [main] org.hibernate.util.JDBCExceptionReporter: SQL Error: -348, SQLState: 428F9
2011-01-31 11:43:34,460 ERROR [main] org.hibernate.util.JDBCExceptionReporter: [SQL0348] Ausdruck NEXT VALUE ist nicht korrekt verwendet.


Translated error message: The expression NEXT VALUE is not used correctly.

When I execute the original query in my SQL Client, everything works find. When I try to execute the subselect generated by Hibernate, the result is fine as well, but when I execute it, with the surrounding query, I get the same error message.

May this be a bug?

best regards,
Andreas


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.