001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.openjpa.persistence.simple;
020:
021: import java.util.Calendar;
022: import java.util.Date;
023: import java.util.TimeZone;
024: import javax.persistence.Entity;
025: import javax.persistence.Temporal;
026: import javax.persistence.TemporalType;
027:
028: @Entity
029: public class TemporalFieldTypes {
030:
031: // Date mapping - Default to TIMESTAMP
032: private Date dateDefaultField;
033:
034: @Temporal(TemporalType.DATE)
035: private Date dateDateField;
036:
037: @Temporal(TemporalType.TIME)
038: private Date dateTimeField;
039:
040: @Temporal(TemporalType.TIMESTAMP)
041: private Date dateTimestampField;
042:
043: // Calendar mapping - Default to TIMESTAMP
044: private Calendar calendarDefaultField;
045:
046: @Temporal(TemporalType.DATE)
047: private Calendar calendarDateField;
048:
049: @Temporal(TemporalType.TIME)
050: private Calendar calendarTimeField;
051:
052: @Temporal(TemporalType.TIMESTAMP)
053: private Calendar calendarTimestampField;
054:
055: private Calendar calendarTimeZoneField = Calendar
056: .getInstance(TimeZone.getTimeZone("Europe/Budapest"));
057:
058: public void setDateDefaultField(Date date) {
059: this .dateDefaultField = date;
060: }
061:
062: public Date getDateDefaultField() {
063: return this .dateDefaultField;
064: }
065:
066: public void setDateDateField(Date date) {
067: this .dateDateField = date;
068: }
069:
070: public Date getDateDateField() {
071: return this .dateDateField;
072: }
073:
074: public void setDateTimeField(Date date) {
075: this .dateTimeField = date;
076: }
077:
078: public Date getDateTimeField() {
079: return this .dateTimeField;
080: }
081:
082: public void setDateTimeStampField(Date date) {
083: this .dateTimestampField = date;
084: }
085:
086: public Date getDateTimeStampField() {
087: return this .dateTimestampField;
088: }
089:
090: public void setCalendarDefaultField(Calendar calendar) {
091: this .calendarDefaultField = calendar;
092: }
093:
094: public Calendar getCalendarDefaultField() {
095: return this .calendarDefaultField;
096: }
097:
098: public void setCalendarDateField(Calendar calendar) {
099: this .calendarDateField = calendar;
100: }
101:
102: public Calendar getCalendarDateField() {
103: return this .calendarDateField;
104: }
105:
106: public void setCalendarTimeField(Calendar calendar) {
107: this .calendarTimeField = calendar;
108: }
109:
110: public Calendar getCalendarTimeField() {
111: return this .calendarTimeField;
112: }
113:
114: public void setCalendarTimeStampField(Calendar calendar) {
115: this .calendarTimestampField = calendar;
116: }
117:
118: public Calendar getCalendarTimeStampField() {
119: return this .calendarTimestampField;
120: }
121:
122: public void setCalendarTimeZoneField(Calendar calendarTimeZoneField) {
123: this .calendarTimeZoneField = calendarTimeZoneField;
124: }
125:
126: public Calendar getCalendarTimeZoneField() {
127: return this.calendarTimeZoneField;
128: }
129:
130: }
|