-->
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.  [ 2 posts ] 
Author Message
 Post subject: Generation strategy enhanced-sequence with DB2 OS 390
PostPosted: Wed Dec 14, 2016 10:33 am 
Newbie

Joined: Fri Nov 11, 2016 5:31 am
Posts: 4
After upgrade from Hibernate 5.0 to 5.2, we would like to change the strategy for id-generation from "enhanced-table" to "enhanced-sequence" (as recommened in the last newsletter).

We use DB2 V11 OS390. It's possible to create/use sequences with that version.

So we use DB2390Dialect as hibernate dialect (as we did with Hibernate 5.0 and previous versions).

But in class DB2390Dialect, the method "supportsSequences()" returns false.

In this case, Hibernate uses the statement
Code:
   select
        next_val as id_val
    from
        TST.HIBERNATE_SEQUENCES for read only with rs use
        and keep update
            locks

This doesn't work.

In class DB2Dialect the method "supportsSequences()" returns true.

If I configure this class as hibernate dialect, Hibernate uses the statement
Code:
values
    nextval for TST.HIBERNATE_SEQUENCES


That works fine.

I think I have to write a class

Quote:
public class DB2390SequenceFixDialect extends DB2390Dialect{

@Override
public boolean supportsSequences() {
return true;
}

}


and configure this class as hibernate dialect. This seems to work. When I configure this class as Hibernate dialect, Hibernate uses the same statement as with DB2Dialect.

Or does anybody have another idea or comment?


Top
 Profile  
 
 Post subject: Re: Generation strategy enhanced-sequence with DB2 OS 390
PostPosted: Wed Dec 14, 2016 11:59 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Thanks for the tip. I'd like you to create a JIRA issue, and you can send us a Pull Request with a test as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.