KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > dialect > DerbyDialect


1 //$Id: DerbyDialect.java,v 1.7 2005/04/13 04:44:34 oneovthafew Exp $
2
package org.hibernate.dialect;
3
4 import org.hibernate.Hibernate;
5 import org.hibernate.dialect.function.VarArgsSQLFunction;
6 import org.hibernate.id.TableHiLoGenerator;
7 import org.hibernate.sql.CaseFragment;
8 import org.hibernate.sql.DerbyCaseFragment;
9
10 /**
11  * @author Simon Johnston
12  *
13  * Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an
14  * override for the identity column generator as well as for the case statement
15  * issue documented at:
16  * http://www.jroller.com/comments/kenlars99/Weblog/cloudscape_soon_to_be_derby
17  */

18 public class DerbyDialect extends DB2Dialect {
19
20     public DerbyDialect() {
21         super();
22         registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","||",")" ) );
23     }
24
25     /**
26      * This is different in Cloudscape to DB2.
27      */

28     public String JavaDoc getIdentityColumnString() {
29         return "not null generated always as identity"; //$NON-NLS-1
30
}
31
32     /**
33      * Return the case statement modified for Cloudscape.
34      */

35     public CaseFragment createCaseFragment() {
36         return new DerbyCaseFragment();
37     }
38
39     public boolean dropConstraints() {
40           return true;
41     }
42     
43     public Class JavaDoc getNativeIdentifierGeneratorClass() {
44         return TableHiLoGenerator.class;
45     }
46     
47     public boolean supportsSequences() {
48         return false;
49     }
50     
51     public boolean supportsLimit() {
52         return false;
53     }
54
55     public boolean supportsLimitOffset() {
56         return false;
57     }
58
59     public String JavaDoc getQuerySequencesString() {
60        return null ;
61     }
62 }
63
Popular Tags