01: /**********************************************************************
02: Copyright (c) 2002 Mike Martin (TJDO) and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15:
16: Contributors:
17: 2003 Andy Jefferson - coding standards and javadocs
18: 2004 Andy Jefferson - removed getTypeInfo() since wasn't used
19: ...
20: **********************************************************************/package org.jpox.store.mapping;
21:
22: import org.jpox.ClassNameConstants;
23:
24: /**
25: * Mapping for Java java.sql.Timestamp char type.
26: *
27: * @version $Revision: 1.13 $
28: **/
29: public class SqlTimestampCharMapping extends SqlTimestampMapping {
30: /**
31: * Method to return the default length of this type in the datastore.
32: * java.sql.Timestamp requires 29 characters ("YYYY-MM-DD HH:MM:SS.FFFFFFFFF")
33: * @param index The index position
34: * @return The default length
35: */
36: public int getDefaultLength(int index) {
37: return 29;
38: }
39:
40: /**
41: * Accessor for the name of the java-type actually used when mapping the particular datastore
42: * field. This java-type must have an entry in the datastore mappings.
43: * @param index requested datastore field index.
44: * @return the name of java-type for the requested datastore field.
45: */
46: public String getJavaTypeForDatastoreMapping(int index) {
47: // Use String as our java type
48: return ClassNameConstants.JAVA_LANG_STRING;
49: }
50: }
|