aboutsummaryrefslogtreecommitdiffstats
path: root/tests/com/iciql/test/models
diff options
context:
space:
mode:
Diffstat (limited to 'tests/com/iciql/test/models')
-rw-r--r--tests/com/iciql/test/models/ComplexObject.java64
-rw-r--r--tests/com/iciql/test/models/Customer.java49
-rw-r--r--tests/com/iciql/test/models/Order.java65
-rw-r--r--tests/com/iciql/test/models/Product.java82
-rw-r--r--tests/com/iciql/test/models/ProductAnnotationOnly.java94
-rw-r--r--tests/com/iciql/test/models/ProductInheritedAnnotation.java63
-rw-r--r--tests/com/iciql/test/models/ProductMixedAnnotation.java94
-rw-r--r--tests/com/iciql/test/models/ProductNoCreateTable.java59
-rw-r--r--tests/com/iciql/test/models/SupportedTypes.java133
9 files changed, 703 insertions, 0 deletions
diff --git a/tests/com/iciql/test/models/ComplexObject.java b/tests/com/iciql/test/models/ComplexObject.java
new file mode 100644
index 0000000..294dc27
--- /dev/null
+++ b/tests/com/iciql/test/models/ComplexObject.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import static com.iciql.Define.primaryKey;
+
+import java.math.BigDecimal;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import com.iciql.Iciql;
+
+/**
+ * A table containing all possible data types.
+ */
+
+public class ComplexObject implements Iciql {
+ public Integer id;
+ public Long amount;
+ public String name;
+ public BigDecimal value;
+ public Date birthday;
+ public Time time;
+ public Timestamp created;
+
+ static ComplexObject build(Integer id, boolean isNull) {
+ ComplexObject obj = new ComplexObject();
+ obj.id = id;
+ obj.amount = isNull ? null : Long.valueOf(1);
+ obj.name = isNull ? null : "hello";
+ obj.value = isNull ? null : new BigDecimal("1");
+ obj.birthday = isNull ? null : java.sql.Date.valueOf("2001-01-01");
+ obj.time = isNull ? null : Time.valueOf("10:20:30");
+ obj.created = isNull ? null : Timestamp.valueOf("2002-02-02 02:02:02");
+ return obj;
+ }
+
+ public void defineIQ() {
+ primaryKey(id);
+ }
+
+ public static List<ComplexObject> getList() {
+ return Arrays.asList(new ComplexObject[] { build(0, true), build(1, false) });
+ }
+
+}
diff --git a/tests/com/iciql/test/models/Customer.java b/tests/com/iciql/test/models/Customer.java
new file mode 100644
index 0000000..c2b8da9
--- /dev/null
+++ b/tests/com/iciql/test/models/Customer.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A table containing customer data.
+ */
+public class Customer {
+
+ public String customerId;
+ public String region;
+
+ public Customer() {
+ // public constructor
+ }
+
+ public Customer(String customerId, String region) {
+ this.customerId = customerId;
+ this.region = region;
+ }
+
+ public String toString() {
+ return customerId;
+ }
+
+ public static List<Customer> getList() {
+ Customer[] list = { new Customer("ALFKI", "WA"), new Customer("ANATR", "WA"), new Customer("ANTON", "CA") };
+ return Arrays.asList(list);
+ }
+
+}
diff --git a/tests/com/iciql/test/models/Order.java b/tests/com/iciql/test/models/Order.java
new file mode 100644
index 0000000..f0cf7f3
--- /dev/null
+++ b/tests/com/iciql/test/models/Order.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import static com.iciql.Define.primaryKey;
+import static com.iciql.Define.tableName;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import com.iciql.Iciql;
+
+/**
+ * A table containing order data.
+ */
+
+public class Order implements Iciql {
+ public String customerId;
+ public Integer orderId;
+ public Date orderDate;
+ public BigDecimal total;
+
+ public Order(String customerId, Integer orderId, String total, String orderDate) {
+ this.customerId = customerId;
+ this.orderId = orderId;
+ this.total = new BigDecimal(total);
+ this.orderDate = java.sql.Date.valueOf(orderDate);
+ }
+
+ public Order() {
+ // public constructor
+ }
+
+ public void defineIQ() {
+ tableName("Orders");
+ primaryKey(customerId, orderId);
+ }
+
+ public static List<Order> getList() {
+ Order[] list = { new Order("ALFKI", 10702, "330.00", "2007-01-02"),
+ new Order("ALFKI", 10952, "471.20", "2007-02-03"), new Order("ANATR", 10308, "88.80", "2007-01-03"),
+ new Order("ANATR", 10625, "479.75", "2007-03-03"), new Order("ANATR", 10759, "320.00", "2007-04-01"),
+ new Order("ANTON", 10365, "403.20", "2007-02-13"), new Order("ANTON", 10682, "375.50", "2007-03-13"),
+ new Order("ANTON", 10355, "480.00", "2007-04-11") };
+ return Arrays.asList(list);
+ }
+
+}
diff --git a/tests/com/iciql/test/models/Product.java b/tests/com/iciql/test/models/Product.java
new file mode 100644
index 0000000..735ebab
--- /dev/null
+++ b/tests/com/iciql/test/models/Product.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import static com.iciql.Define.index;
+import static com.iciql.Define.maxLength;
+import static com.iciql.Define.primaryKey;
+import static com.iciql.Define.tableName;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.iciql.Iciql;
+
+/**
+ * A table containing product data.
+ */
+
+public class Product implements Iciql {
+
+ public Integer productId;
+ public String productName;
+ public String category;
+ public Double unitPrice;
+ public Integer unitsInStock;
+
+ public Product() {
+ // public constructor
+ }
+
+ private Product(int productId, String productName, String category, double unitPrice, int unitsInStock) {
+ this.productId = productId;
+ this.productName = productName;
+ this.category = category;
+ this.unitPrice = unitPrice;
+ this.unitsInStock = unitsInStock;
+ }
+
+ public void defineIQ() {
+ tableName("Product");
+ primaryKey(productId);
+ maxLength(category, 255);
+ index(productName, category);
+ }
+
+ private static Product create(int productId, String productName, String category, double unitPrice, int unitsInStock) {
+ return new Product(productId, productName, category, unitPrice, unitsInStock);
+ }
+
+ public static List<Product> getList() {
+ Product[] list = { create(1, "Chai", "Beverages", 18, 39), create(2, "Chang", "Beverages", 19.0, 17),
+ create(3, "Aniseed Syrup", "Condiments", 10.0, 13),
+ create(4, "Chef Anton's Cajun Seasoning", "Condiments", 22.0, 53),
+ create(5, "Chef Anton's Gumbo Mix", "Condiments", 21.3500, 0),
+ create(6, "Grandma's Boysenberry Spread", "Condiments", 25.0, 120),
+ create(7, "Uncle Bob's Organic Dried Pears", "Produce", 30.0, 15),
+ create(8, "Northwoods Cranberry Sauce", "Condiments", 40.0, 6),
+ create(9, "Mishi Kobe Niku", "Meat/Poultry", 97.0, 29), create(10, "Ikura", "Seafood", 31.0, 31), };
+
+ return Arrays.asList(list);
+ }
+
+ public String toString() {
+ return productName + ": " + unitsInStock;
+ }
+
+}
diff --git a/tests/com/iciql/test/models/ProductAnnotationOnly.java b/tests/com/iciql/test/models/ProductAnnotationOnly.java
new file mode 100644
index 0000000..7921237
--- /dev/null
+++ b/tests/com/iciql/test/models/ProductAnnotationOnly.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.iciql.Iciql.IQColumn;
+import com.iciql.Iciql.IQIndex;
+import com.iciql.Iciql.IQTable;
+
+/**
+ * A table containing product data.
+ */
+
+@IQTable(name = "AnnotatedProduct", primaryKey = "id")
+@IQIndex(standard = "name, cat")
+public class ProductAnnotationOnly {
+
+ @IQColumn(autoIncrement = true)
+ public Integer autoIncrement;
+
+ public String unmappedField;
+
+ @IQColumn(name = "id")
+ public Integer productId;
+
+ @IQColumn(name = "cat", maxLength = 15, trimString = true)
+ public String category;
+
+ @IQColumn(name = "name")
+ private String productName;
+
+ @SuppressWarnings("unused")
+ @IQColumn
+ private Double unitPrice;
+
+ @IQColumn
+ private Integer unitsInStock;
+
+ public ProductAnnotationOnly() {
+ // public constructor
+ }
+
+ private ProductAnnotationOnly(int productId, String productName, String category, double unitPrice,
+ int unitsInStock, String unmappedField) {
+ this.productId = productId;
+ this.productName = productName;
+ this.category = category;
+ this.unitPrice = unitPrice;
+ this.unitsInStock = unitsInStock;
+ this.unmappedField = unmappedField;
+ }
+
+ private static ProductAnnotationOnly create(int productId, String productName, String category, double unitPrice,
+ int unitsInStock, String unmappedField) {
+ return new ProductAnnotationOnly(productId, productName, category, unitPrice, unitsInStock, unmappedField);
+ }
+
+ public static List<ProductAnnotationOnly> getList() {
+ String unmappedField = "unmapped";
+ ProductAnnotationOnly[] list = { create(1, "Chai", "Beverages", 18, 39, unmappedField),
+ create(2, "Chang", "Beverages", 19.0, 17, unmappedField),
+ create(3, "Aniseed Syrup", "Condiments", 10.0, 13, unmappedField),
+ create(4, "Chef Anton's Cajun Seasoning", "Condiments", 22.0, 53, unmappedField),
+ create(5, "Chef Anton's Gumbo Mix", "Condiments", 21.3500, 0, unmappedField),
+ create(6, "Grandma's Boysenberry Spread", "Condiments", 25.0, 120, unmappedField),
+ create(7, "Uncle Bob's Organic Dried Pears", "Produce", 30.0, 15, unmappedField),
+ create(8, "Northwoods Cranberry Sauce", "Condiments", 40.0, 6, unmappedField),
+ create(9, "Mishi Kobe Niku", "Meat/Poultry", 97.0, 29, unmappedField),
+ create(10, "Ikura", "Seafood", 31.0, 31, unmappedField), };
+ return Arrays.asList(list);
+ }
+
+ public String toString() {
+ return productName + ": " + unitsInStock;
+ }
+
+}
diff --git a/tests/com/iciql/test/models/ProductInheritedAnnotation.java b/tests/com/iciql/test/models/ProductInheritedAnnotation.java
new file mode 100644
index 0000000..0a63aae
--- /dev/null
+++ b/tests/com/iciql/test/models/ProductInheritedAnnotation.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.iciql.Iciql.IQTable;
+
+/**
+ * This class inherits all its fields from a parent class which has annotated
+ * columns. The IQTable annotation of the parent class is ignored and only the
+ * IQTable annotation of this class matters. However, this table inherits
+ * IQColumns from its super class.
+ */
+@IQTable(inheritColumns = true, annotationsOnly = false)
+public class ProductInheritedAnnotation extends ProductMixedAnnotation {
+
+ public ProductInheritedAnnotation() {
+ // public constructor
+ }
+
+ private ProductInheritedAnnotation(int productId, String productName, String category, double unitPrice,
+ int unitsInStock, String mappedField) {
+ super(productId, productName, category, unitPrice, unitsInStock, mappedField);
+ }
+
+ private static ProductInheritedAnnotation create(int productId, String productName, String category,
+ double unitPrice, int unitsInStock, String mappedField) {
+ return new ProductInheritedAnnotation(productId, productName, category, unitPrice, unitsInStock, mappedField);
+ }
+
+ public static List<ProductInheritedAnnotation> getData() {
+ String mappedField = "mapped";
+ ProductInheritedAnnotation[] list = { create(1, "Chai", "Beverages", 18, 39, mappedField),
+ create(2, "Chang", "Beverages", 19.0, 17, mappedField),
+ create(3, "Aniseed Syrup", "Condiments", 10.0, 13, mappedField),
+ create(4, "Chef Anton's Cajun Seasoning", "Condiments", 22.0, 53, mappedField),
+ create(5, "Chef Anton's Gumbo Mix", "Condiments", 21.3500, 0, mappedField),
+ create(6, "Grandma's Boysenberry Spread", "Condiments", 25.0, 120, mappedField),
+ create(7, "Uncle Bob's Organic Dried Pears", "Produce", 30.0, 15, mappedField),
+ create(8, "Northwoods Cranberry Sauce", "Condiments", 40.0, 6, mappedField),
+ create(9, "Mishi Kobe Niku", "Meat/Poultry", 97.0, 29, mappedField),
+ create(10, "Ikura", "Seafood", 31.0, 31, mappedField), };
+ return Arrays.asList(list);
+ }
+
+}
diff --git a/tests/com/iciql/test/models/ProductMixedAnnotation.java b/tests/com/iciql/test/models/ProductMixedAnnotation.java
new file mode 100644
index 0000000..f90bd65
--- /dev/null
+++ b/tests/com/iciql/test/models/ProductMixedAnnotation.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.iciql.Iciql.IQColumn;
+import com.iciql.Iciql.IQIndex;
+import com.iciql.Iciql.IQTable;
+
+/**
+ * A table containing product data.
+ */
+
+@IQTable(annotationsOnly = false)
+@IQIndex(standard = "name, cat")
+public class ProductMixedAnnotation {
+
+ public Double unitPrice;
+ public Integer unitsInStock;
+ public String mappedField;
+
+ @IQColumn(name = "cat", maxLength = 255)
+ public String category;
+
+ @IQColumn(name = "id", primaryKey = true)
+ private Integer productId;
+
+ @IQColumn(name = "name")
+ private String productName;
+
+ public ProductMixedAnnotation() {
+ // public constructor
+ }
+
+ protected ProductMixedAnnotation(int productId, String productName, String category, double unitPrice,
+ int unitsInStock, String mappedField) {
+ this.productId = productId;
+ this.productName = productName;
+ this.category = category;
+ this.unitPrice = unitPrice;
+ this.unitsInStock = unitsInStock;
+ this.mappedField = mappedField;
+ }
+
+ private static ProductMixedAnnotation create(int productId, String productName, String category, double unitPrice,
+ int unitsInStock, String mappedField) {
+ return new ProductMixedAnnotation(productId, productName, category, unitPrice, unitsInStock, mappedField);
+ }
+
+ public static List<ProductMixedAnnotation> getList() {
+ String mappedField = "mapped";
+ ProductMixedAnnotation[] list = { create(1, "Chai", "Beverages", 18, 39, mappedField),
+ create(2, "Chang", "Beverages", 19.0, 17, mappedField),
+ create(3, "Aniseed Syrup", "Condiments", 10.0, 13, mappedField),
+ create(4, "Chef Anton's Cajun Seasoning", "Condiments", 22.0, 53, mappedField),
+ create(5, "Chef Anton's Gumbo Mix", "Condiments", 21.3500, 0, mappedField),
+ create(6, "Grandma's Boysenberry Spread", "Condiments", 25.0, 120, mappedField),
+ create(7, "Uncle Bob's Organic Dried Pears", "Produce", 30.0, 15, mappedField),
+ create(8, "Northwoods Cranberry Sauce", "Condiments", 40.0, 6, mappedField),
+ create(9, "Mishi Kobe Niku", "Meat/Poultry", 97.0, 29, mappedField),
+ create(10, "Ikura", "Seafood", 31.0, 31, mappedField), };
+ return Arrays.asList(list);
+ }
+
+ public String toString() {
+ return productName + ": " + unitsInStock;
+ }
+
+ public int id() {
+ return productId;
+ }
+
+ public String name() {
+ return productName;
+ }
+
+}
diff --git a/tests/com/iciql/test/models/ProductNoCreateTable.java b/tests/com/iciql/test/models/ProductNoCreateTable.java
new file mode 100644
index 0000000..074af35
--- /dev/null
+++ b/tests/com/iciql/test/models/ProductNoCreateTable.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.iciql.Iciql.IQColumn;
+import com.iciql.Iciql.IQTable;
+
+/**
+ * A table containing product data.
+ */
+
+@IQTable(createIfRequired = false)
+public class ProductNoCreateTable {
+
+ @SuppressWarnings("unused")
+ @IQColumn(name = "id")
+ private Integer productId;
+
+ @SuppressWarnings("unused")
+ @IQColumn(name = "name")
+ private String productName;
+
+ public ProductNoCreateTable() {
+ // public constructor
+ }
+
+ private ProductNoCreateTable(int productId, String productName) {
+ this.productId = productId;
+ this.productName = productName;
+ }
+
+ private static ProductNoCreateTable create(int productId, String productName) {
+ return new ProductNoCreateTable(productId, productName);
+ }
+
+ public static List<ProductNoCreateTable> getList() {
+ ProductNoCreateTable[] list = { create(1, "Chai"), create(2, "Chang") };
+ return Arrays.asList(list);
+ }
+
+}
diff --git a/tests/com/iciql/test/models/SupportedTypes.java b/tests/com/iciql/test/models/SupportedTypes.java
new file mode 100644
index 0000000..26692fc
--- /dev/null
+++ b/tests/com/iciql/test/models/SupportedTypes.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2004-2011 H2 Group.
+ * Copyright 2011 James Moger.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.iciql.test.models;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Random;
+
+import com.iciql.Iciql.IQColumn;
+import com.iciql.Iciql.IQTable;
+import com.iciql.util.Utils;
+
+/**
+ * A data class that contains a column for each data type.
+ */
+@IQTable(strictTypeMapping = true, version = 1)
+public class SupportedTypes {
+
+ public static final SupportedTypes SAMPLE = new SupportedTypes();
+
+ @IQColumn(primaryKey = true, autoIncrement = true)
+ public Integer id;
+
+ @IQColumn
+ private Boolean myBool = false;
+
+ @IQColumn
+ private Byte myByte = 2;
+
+ @IQColumn
+ private Short myShort;
+
+ @IQColumn
+ private Integer myInteger;
+
+ @IQColumn
+ private Long myLong;
+
+ @IQColumn
+ private Float myFloat = 1.0f;
+
+ @IQColumn
+ private Double myDouble;
+
+ @IQColumn
+ private BigDecimal myBigDecimal;
+
+ @IQColumn
+ private String myString;
+
+ @IQColumn
+ private java.util.Date myUtilDate;
+
+ @IQColumn
+ private java.sql.Date mySqlDate;
+
+ @IQColumn
+ private java.sql.Time mySqlTime;
+
+ @IQColumn
+ private java.sql.Timestamp mySqlTimestamp;
+
+ public static List<SupportedTypes> createList() {
+ List<SupportedTypes> list = Utils.newArrayList();
+ for (int i = 0; i < 10; i++) {
+ list.add(randomValue());
+ }
+ return list;
+ }
+
+ static SupportedTypes randomValue() {
+ Random rand = new Random();
+ SupportedTypes s = new SupportedTypes();
+ s.myBool = new Boolean(rand.nextBoolean());
+ s.myByte = new Byte((byte) rand.nextInt(Byte.MAX_VALUE));
+ s.myShort = new Short((short) rand.nextInt(Short.MAX_VALUE));
+ s.myInteger = new Integer(rand.nextInt());
+ s.myLong = new Long(rand.nextLong());
+ s.myFloat = new Float(rand.nextFloat());
+ s.myDouble = new Double(rand.nextDouble());
+ s.myBigDecimal = new BigDecimal(rand.nextDouble());
+ s.myString = Long.toHexString(rand.nextLong());
+ s.myUtilDate = new java.util.Date(rand.nextLong());
+ s.mySqlDate = new java.sql.Date(rand.nextLong());
+ s.mySqlTime = new java.sql.Time(rand.nextLong());
+ s.mySqlTimestamp = new java.sql.Timestamp(rand.nextLong());
+ return s;
+ }
+
+ public boolean equivalentTo(SupportedTypes s) {
+ boolean same = true;
+ same &= myBool.equals(s.myBool);
+ same &= myByte.equals(s.myByte);
+ same &= myShort.equals(s.myShort);
+ same &= myInteger.equals(s.myInteger);
+ same &= myLong.equals(s.myLong);
+ same &= myFloat.equals(s.myFloat);
+ same &= myDouble.equals(s.myDouble);
+ same &= myBigDecimal.equals(s.myBigDecimal);
+ same &= myUtilDate.getTime() == s.myUtilDate.getTime();
+ same &= mySqlTimestamp.getTime() == s.mySqlTimestamp.getTime();
+ same &= mySqlDate.toString().equals(s.mySqlDate.toString());
+ same &= mySqlTime.toString().equals(s.mySqlTime.toString());
+ same &= myString.equals(s.myString);
+ return same;
+ }
+
+ /**
+ * This class demonstrates the table upgrade.
+ */
+ @IQTable(name = "SupportedTypes", version = 2, inheritColumns = true, strictTypeMapping = true)
+ public static class SupportedTypes2 extends SupportedTypes {
+
+ public SupportedTypes2() {
+ // nothing to do
+ }
+ }
+}