KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > platform > database > HSQLPlatform


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.platform.database;
23
24 import java.util.*;
25 import oracle.toplink.essentials.internal.databaseaccess.*;
26
27 /**
28  * <p><b>Purpose</b>: Provides HSQL specific behaviour.
29  *
30  * @since TOPLink/Java 4.5
31  */

32 public class HSQLPlatform extends DatabasePlatform {
33     public HSQLPlatform() {
34     }
35
36     protected Hashtable buildFieldTypes() {
37         Hashtable fieldTypeMapping;
38
39         fieldTypeMapping = super.buildFieldTypes();
40         fieldTypeMapping.put(Boolean JavaDoc.class, new FieldTypeDefinition("TINYINT", false));
41
42         fieldTypeMapping.put(Integer JavaDoc.class, new FieldTypeDefinition("INTEGER", false));
43         fieldTypeMapping.put(Long JavaDoc.class, new FieldTypeDefinition("NUMERIC", 19));
44         fieldTypeMapping.put(Float JavaDoc.class, new FieldTypeDefinition("REAL", false));
45         fieldTypeMapping.put(Double JavaDoc.class, new FieldTypeDefinition("REAL", false));
46         fieldTypeMapping.put(Short JavaDoc.class, new FieldTypeDefinition("SMALLINT", false));
47         fieldTypeMapping.put(Byte JavaDoc.class, new FieldTypeDefinition("SMALLINT", false));
48         fieldTypeMapping.put(java.math.BigInteger JavaDoc.class, new FieldTypeDefinition("NUMERIC", 38));
49         fieldTypeMapping.put(java.math.BigDecimal JavaDoc.class, new FieldTypeDefinition("NUMERIC", 38).setLimits(38, -19, 19));
50         fieldTypeMapping.put(Number JavaDoc.class, new FieldTypeDefinition("NUMERIC", 38).setLimits(38, -19, 19));
51         fieldTypeMapping.put(Byte JavaDoc[].class, new FieldTypeDefinition("BINARY", false));
52         fieldTypeMapping.put(Character JavaDoc[].class, new FieldTypeDefinition("LONGVARCHAR", false));
53         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BINARY", false));
54         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("LONGVARCHAR", false));
55         fieldTypeMapping.put(java.sql.Blob JavaDoc.class, new FieldTypeDefinition("BINARY", false));
56         fieldTypeMapping.put(java.sql.Clob JavaDoc.class, new FieldTypeDefinition("LONGVARCHAR", false));
57
58         return fieldTypeMapping;
59     }
60
61     public boolean isHSQL() {
62         return true;
63     }
64
65     /**
66      * INTERNAL:
67      * HSQL 1.6.1 does not support the ALTER TABLE method of create foreign key constraints
68      */

69     public boolean supportsForeignKeyConstraints() {
70         return false;
71     }
72 }
73
Popular Tags