19 package com.mysql.clusterj.jpatest;
21 import java.sql.PreparedStatement;
22 import java.sql.ResultSet;
23 import java.sql.SQLException;
24 import java.sql.Timestamp;
26 import com.mysql.clusterj.jpatest.model.TimestampAsSqlTimestampTypes;
27 import com.mysql.clusterj.jpatest.model.IdBase;
62 static int NUMBER_OF_INSTANCES = 10;
71 return NUMBER_OF_INSTANCES;
76 return "timestamptypes";
88 return new Timestamp(
getMillisFor(1980, 0, i + 1, 0, 0, j));
97 public void testWriteJDBCReadJPA() {
102 public void testWriteJPAReadJDBC() {
107 public void testWriteJDBCReadJDBC() {
112 public void testWriteJPAReadJPA() {
117 static ColumnDescriptor not_null_hash =
new ColumnDescriptor
118 (
"timestamp_not_null_hash",
new InstanceHandler() {
119 public void setFieldValue(IdBase instance, Object value) {
120 ((TimestampAsSqlTimestampTypes)instance).setTimestamp_not_null_hash((Timestamp)value);
122 public Object getFieldValue(IdBase instance) {
123 return ((TimestampAsSqlTimestampTypes)instance).getTimestamp_not_null_hash();
125 public void setPreparedStatementValue(PreparedStatement preparedStatement,
int j, Object value)
126 throws SQLException {
127 preparedStatement.setTimestamp(j, (Timestamp)value);
129 public Object getResultSetValue(ResultSet rs,
int j)
throws SQLException {
130 return rs.getTimestamp(j);
134 static ColumnDescriptor not_null_btree =
new ColumnDescriptor
135 (
"timestamp_not_null_btree",
new InstanceHandler() {
136 public void setFieldValue(IdBase instance, Object value) {
137 ((TimestampAsSqlTimestampTypes)instance).setTimestamp_not_null_btree((Timestamp)value);
139 public Object getFieldValue(IdBase instance) {
140 return ((TimestampAsSqlTimestampTypes)instance).getTimestamp_not_null_btree();
142 public void setPreparedStatementValue(PreparedStatement preparedStatement,
int j, Object value)
143 throws SQLException {
144 preparedStatement.setTimestamp(j, (Timestamp)value);
146 public Object getResultSetValue(ResultSet rs,
int j)
throws SQLException {
147 return rs.getTimestamp(j);
151 static ColumnDescriptor not_null_both =
new ColumnDescriptor
152 (
"timestamp_not_null_both",
new InstanceHandler() {
153 public void setFieldValue(IdBase instance, Object value) {
154 ((TimestampAsSqlTimestampTypes)instance).setTimestamp_not_null_both((Timestamp)value);
156 public Timestamp getFieldValue(IdBase instance) {
157 return ((TimestampAsSqlTimestampTypes)instance).getTimestamp_not_null_both();
159 public void setPreparedStatementValue(PreparedStatement preparedStatement,
int j, Object value)
160 throws SQLException {
161 preparedStatement.setTimestamp(j, (Timestamp)value);
163 public Object getResultSetValue(ResultSet rs,
int j)
throws SQLException {
164 return rs.getTimestamp(j);
168 static ColumnDescriptor not_null_none =
new ColumnDescriptor
169 (
"timestamp_not_null_none",
new InstanceHandler() {
170 public void setFieldValue(IdBase instance, Object value) {
171 ((TimestampAsSqlTimestampTypes)instance).setTimestamp_not_null_none((Timestamp)value);
173 public Timestamp getFieldValue(IdBase instance) {
174 return ((TimestampAsSqlTimestampTypes)instance).getTimestamp_not_null_none();
176 public void setPreparedStatementValue(PreparedStatement preparedStatement,
int j, Object value)
177 throws SQLException {
178 preparedStatement.setTimestamp(j, (Timestamp)value);
180 public Object getResultSetValue(ResultSet rs,
int j)
throws SQLException {
181 return rs.getTimestamp(j);
185 protected static ColumnDescriptor[] columnDescriptors =
new ColumnDescriptor[] {
194 return columnDescriptors;