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: Contributors:
16: 2003 Andy Jefferson - coding standards and javadocs
17: 2004 Andy Jefferson - removed getTypeInfo() since wasn't used.
18: ...
19: **********************************************************************/package org.jpox.store.mapping;
20:
21: import org.jpox.ClassNameConstants;
22:
23: /**
24: * SCO Mapping for SQLDate type as char.
25: *
26: * @version $Revision: 1.13 $
27: **/
28: public class SqlDateCharMapping extends SqlDateMapping {
29: /**
30: * Method to return the default length of this type in the datastore.
31: * java.sql.Date requires 10 characters ("YYYY-MM-DD")
32: * @param index The index position
33: * @return The default length
34: */
35: public int getDefaultLength(int index) {
36: return 10;
37: }
38:
39: /**
40: * Accessor for the name of the java-type actually used when mapping the particular datastore
41: * field. This java-type must have an entry in the datastore mappings.
42: * @param index requested datastore field index.
43: * @return the name of java-type for the requested datastore field.
44: */
45: public String getJavaTypeForDatastoreMapping(int index) {
46: // Use String as our java type
47: return ClassNameConstants.JAVA_LANG_STRING;
48: }
49: }
|