Message:
The following issue has been closed.
Resolver: Max Rydahl Andersen
Date: Fri, 2 Jan 2004 11:06 AM
In cvs - thanx
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-595
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-595
Summary: DB2 dialect extension for DB2 UDB for iSeries aka DB2/400
Type: Patch
Status: Closed
Priority: Trivial
Resolution: FIXED
Project: Hibernate2
Components:
core
Fix Fors:
2.1.1
Versions:
2.1
Assignee:
Reporter: Peter DeGregorio
Created: Fri, 2 Jan 2004 10:32 AM
Updated: Fri, 2 Jan 2004 11:06 AM
Environment: Hibernate Version 2.1 with DB2 Universal Database for iSeries (AS/400) V5R2
Description:
DB2/400 SQL differs from DB2 UDB for Linux/Unix/Windows in several respects which affect its use with Hibernate. A subclass of DB2Dialect is provided here to address the problems that arose when running the sample application "eg" against DB2/400. Also, additional lines for hibernate.properties are given to make use of the new class. Among the differences between DB2 UDB and DB2/400 are identity columns, rownumber() over() and whether limit may be specified as a variable.
Index: src/hibernate.properties
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/hibernate.properties,v
retrieving revision 1.19
diff -u -r1.19 hibernate.properties
--- src/hibernate.properties 15 Jun 2003 08:15:22 -0000 1.19
+++ src/hibernate.properties 2 Jan 2004 16:01:25 -0000
@@ -41,6 +41,18 @@
#hibernate.connection.username db2
#hibernate.connection.password db2
+## DB2/400
+
+#hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect
+## Native driver
+##hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
+##hibernate.connection.url jdbc:db2://systemname
+## or Toolbox driver
+##hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
+##hibernate.connection.url jdbc:as400://systemname
+#hibernate.connection.username user
+#hibernate.connection.password password
+
## MySQL
Index: src/net/sf/hibernate/dialect/DB2400Dialect.java
===================================================================
RCS file: src/net/sf/hibernate/dialect/DB2400Dialect.java
diff -N src/net/sf/hibernate/dialect/DB2400Dialect.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/net/sf/hibernate/dialect/DB2400Dialect.java 2 Jan 2004 16:01:26 -0000
@@ -0,0 +1,48 @@
+package net.sf.hibernate.dialect;
+
+/**
+* An SQL dialect for DB2/400
+* @author Peter DeGregorio (pdegregorio)
+* This class provides support for DB2 Universal Database for iSeries,
+* also known as DB2/400.
+*/
+public class DB2400Dialect extends DB2Dialect {
+
+ public DB2400Dialect() {
+ super();
+ }
+
+ public boolean supportsIdentityColumns() {
+ return false;
+ }
+
+ public boolean supportsSequences() {
+ return false;
+ }
+
+ 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;
+ }
+
+}
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|