diff --git a/pom.xml b/pom.xml
index 185aa2d..e29a717 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.dieselpoint
norm
Norm
- 0.8.1
+ 0.8.2
jar
An extremely lightweight data access layer over JDBC
@@ -49,6 +49,7 @@
+
@@ -61,7 +62,7 @@
maven-compiler-plugin
- 3.5.1
+ 3.7.0
1.8
@@ -83,7 +84,11 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 2.10.4
+ 3.0.0
+
+ -Xdoclint:none
+ -Xdoclint:none
+
attach-javadocs
@@ -135,20 +140,20 @@
com.zaxxer
HikariCP
- 2.6.1
+ 3.1.0
mysql
mysql-connector-java
- 6.0.6
+ 8.0.11
test
org.postgresql
postgresql
- 42.0.0
+ 42.2.2
test
diff --git a/src/main/java/com/dieselpoint/norm/ColumnOrder.java b/src/main/java/com/dieselpoint/norm/ColumnOrder.java
index a38fbc2..7ec61f0 100644
--- a/src/main/java/com/dieselpoint/norm/ColumnOrder.java
+++ b/src/main/java/com/dieselpoint/norm/ColumnOrder.java
@@ -8,7 +8,7 @@
/**
* Specify the order of the columns. Is used in the create table sql.
- * @ColumnOrder({"name","address", ...})
+ * ColumnOrder({"name","address", ...})
*
* @author ccleve
*/
diff --git a/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java b/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java
index 1217df9..2f441b9 100644
--- a/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java
+++ b/src/main/java/com/dieselpoint/norm/sqlmakers/StandardSqlMaker.java
@@ -334,7 +334,8 @@ public void populateGeneratedKey(ResultSet generatedKeys, Object insertRow) {
if (prop == null) {
throw new DbException("The database table has an autogenerated key, but the pojo doesn't have a field with a @GeneratedValue annotation.");
}
- boolean isInt = prop.dataType.isAssignableFrom(int.class); // int or long
+ // is it an int or a long?
+ boolean isInt = prop.dataType.isAssignableFrom(int.class) || prop.dataType.isAssignableFrom(Integer.class);
Object newKey;
diff --git a/src/test/java/com/dieselpoint/norm/TestGeneratedId.java b/src/test/java/com/dieselpoint/norm/TestGeneratedId.java
new file mode 100644
index 0000000..2a93a54
--- /dev/null
+++ b/src/test/java/com/dieselpoint/norm/TestGeneratedId.java
@@ -0,0 +1,112 @@
+package com.dieselpoint.norm;
+
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.dieselpoint.norm.Database;
+
+
+public class TestGeneratedId {
+
+ static String DB_DRIVER_CLASS_NAME = "org.postgresql.ds.PGSimpleDataSource";
+ static String DB_SERVER_NAME = "localhost";
+ static String DB_DATABASE = "testdb";
+ static String DB_USERNAME = "postgres";
+ static String DB_PASSWORD = "rootpassword";
+
+ private Database db;
+
+ @Before
+ public void setUp() {
+ System.setProperty("norm.dataSourceClassName", DB_DRIVER_CLASS_NAME);
+ System.setProperty("norm.serverName", DB_SERVER_NAME);
+ System.setProperty("norm.databaseName", DB_DATABASE);
+ System.setProperty("norm.user", DB_USERNAME);
+ System.setProperty("norm.password", DB_PASSWORD);
+
+ db = new Database();
+ }
+
+ @Test
+ public void testCreate() {
+ NormPojo np = new NormPojo();
+ np.setId("MyID");
+ np.setName("My name");
+ db.insert(np);
+ Assert.assertNotNull(np.getDatabaseId());
+ }
+
+ @Test
+ public void testRetrieval() {
+ List npList = null;
+ npList = db.results(NormPojo.class);
+ Assert.assertNotNull(npList);
+ Assert.assertTrue(npList.size() > 0);
+ }
+
+ @Table(name = "pojo")
+ public static class NormPojo {
+
+ /** Database record ID. */
+ private Integer databaseId;
+
+ /** Unique identifier of the object. */
+ private String id;
+
+ /** Human readable name. */
+ private String name;
+
+ /**
+ * @return the id
+ */
+ @Column(name = "object_id", unique = true)
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the name
+ */
+ @Column(name = "name")
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Id
+ @GeneratedValue
+ @Column(name = "id")
+ public Integer getDatabaseId() {
+ return databaseId;
+ }
+
+ public void setDatabaseId(Integer databaseId) {
+ this.databaseId = databaseId;
+ }
+
+ }
+
+
+
+}