1 /* 2 Copyright (c) 2010, 2021, Oracle and/or its affiliates. 3 All rights reserved. Use is subject to license terms. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 2.0, 7 as published by the Free Software Foundation. 8 9 This program is also distributed with certain software (including 10 but not limited to OpenSSL) that is licensed under separate terms, 11 as designated in a particular file or component or in included license 12 documentation. The authors of MySQL hereby grant you an additional 13 permission to link the program and your derivative works with the 14 separately licensed software that they have included with MySQL. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License, version 2.0, for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 */ 25 26 package com.mysql.clusterj.jpatest.model; 27 28 import java.sql.Timestamp; 29 30 import javax.persistence.Column; 31 import javax.persistence.Entity; 32 import javax.persistence.Id; 33 import javax.persistence.Table; 34 35 /** Schema 36 * 37 drop table if exists datetimetypes; 38 create table datetimetypes ( 39 id int not null primary key, 40 41 datetime_null_hash datetime, 42 datetime_null_btree datetime, 43 datetime_null_both datetime, 44 datetime_null_none datetime, 45 46 datetime_not_null_hash datetime, 47 datetime_not_null_btree datetime, 48 datetime_not_null_both datetime, 49 datetime_not_null_none datetime 50 51 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1; 52 53 create unique index idx_datetime_null_hash using hash on datetimetypes(datetime_null_hash); 54 create index idx_datetime_null_btree on datetimetypes(datetime_null_btree); 55 create unique index idx_datetime_null_both on datetimetypes(datetime_null_both); 56 57 create unique index idx_datetime_not_null_hash using hash on datetimetypes(datetime_not_null_hash); 58 create index idx_datetime_not_null_btree on datetimetypes(datetime_not_null_btree); 59 create unique index idx_datetime_not_null_both on datetimetypes(datetime_not_null_both); 60 61 */ 62 @Entity 63 @Table(name="datetimetypes") 64 public class DatetimeAsSqlTimestampTypes implements IdBase { 65 66 private int id; 67 private Timestamp datetime_not_null_hash; 68 private Timestamp datetime_not_null_btree; 69 private Timestamp datetime_not_null_both; 70 private Timestamp datetime_not_null_none; 71 72 @Id getId()73 public int getId() { 74 return id; 75 } setId(int id)76 public void setId(int id) { 77 this.id = id; 78 } 79 80 // Timestamp 81 @Column(name="datetime_not_null_hash") getDatetime_not_null_hash()82 public Timestamp getDatetime_not_null_hash() { 83 return datetime_not_null_hash; 84 } setDatetime_not_null_hash(Timestamp value)85 public void setDatetime_not_null_hash(Timestamp value) { 86 this.datetime_not_null_hash = value; 87 } 88 89 @Column(name="datetime_not_null_btree") getDatetime_not_null_btree()90 public Timestamp getDatetime_not_null_btree() { 91 return datetime_not_null_btree; 92 } setDatetime_not_null_btree(Timestamp value)93 public void setDatetime_not_null_btree(Timestamp value) { 94 this.datetime_not_null_btree = value; 95 } 96 97 @Column(name="datetime_not_null_both") getDatetime_not_null_both()98 public Timestamp getDatetime_not_null_both() { 99 return datetime_not_null_both; 100 } setDatetime_not_null_both(Timestamp value)101 public void setDatetime_not_null_both(Timestamp value) { 102 this.datetime_not_null_both = value; 103 } 104 105 @Column(name="datetime_not_null_none") getDatetime_not_null_none()106 public Timestamp getDatetime_not_null_none() { 107 return datetime_not_null_none; 108 } setDatetime_not_null_none(Timestamp value)109 public void setDatetime_not_null_none(Timestamp value) { 110 this.datetime_not_null_none = value; 111 } 112 113 } 114