-->
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.  [ 4 posts ] 
Author Message
 Post subject: Dialect for OS/390
PostPosted: Mon Apr 26, 2004 8:24 am 
Newbie

Joined: Thu Mar 11, 2004 6:56 am
Posts: 5
The existing Dialects for DB/2 do not handle identity columns properly on OS/390 (at least not on the installation we use in my current project). Have created a DB2390Dialect to fix this issue.

Not heavily tested, and might not be a "perfect" solution, but this implementation of getIdentitySelectString() behaves nicely on our OS/390 platform.


Code:
package net.sf.hibernate.dialect;

/**
* An SQL dialect for DB2/390
* @author
* This class provides support for DB2 Universal Database for OS/390,
* also known as DB2/390.
*/
public class DB2390Dialect extends DB2Dialect {

   public DB2390Dialect() {
      super();
   }

   public boolean supportsSequences() {
      return false;
   }

    public String getIdentitySelectString() {
      return "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1";
    }


   public boolean supportsLimit() {
      return true;
   }

   public boolean supportsLimitOffset() {
      return false;
   }

   public String getLimitString(String sql, boolean hasOffset, int limit) {
      return new StringBuffer(sql.length() + 40)
         .append(sql)
         .append(" fetch first ")
         .append(limit)
         .append(" rows only ")
         .toString();
   }

   public boolean useMaxForLimit() {
      return true;
   }

   public boolean supportsVariableLimit() {
      return false;
   }

}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2004 8:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Thanks, would you please submit this to JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2004 8:56 am 
Newbie

Joined: Thu Mar 11, 2004 6:56 am
Posts: 5
Done!

Posted as HB-917, adjust status and priority as necessary.


Top
 Profile  
 
 Post subject: Identity value is null after commit
PostPosted: Fri Apr 14, 2006 4:05 am 
Newbie

Joined: Fri Apr 14, 2006 3:51 am
Posts: 2
Location: Belgium
In DB2 v8 on OS/390, the statement:

Code:
SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1

will return <null> if there has been a commit between the single insert statement and the retrieval of the identity value.

I'm not sure if this is intended, but it surely is annoying, especially if you flush the session in your code and get an hibernate error back saying the the ID of your newly created object is null if you use it afterwards.

This does not happend on DB2 UDB on any other platform, since a commit between the insert and retrieval has no effect on the identity_val_local() function.


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