diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index dc3affce..b9b1153a 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar diff --git a/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/BaseTest.java b/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/BaseTest.java index 3c474f32..23d5c38b 100644 --- a/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/BaseTest.java +++ b/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/BaseTest.java @@ -3,7 +3,6 @@ import java.util.Arrays; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module; import static org.junit.jupiter.api.Assertions.fail; diff --git a/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/ReplacePersistentCollectionTest.java b/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/ReplacePersistentCollectionTest.java index 4fd234cd..cee6a6ff 100644 --- a/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/ReplacePersistentCollectionTest.java +++ b/hibernate4/src/test/java/com/fasterxml/jackson/datatype/hibernate4/ReplacePersistentCollectionTest.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.datatype.hibernate4.data.Customer; import com.fasterxml.jackson.datatype.hibernate4.data.Payment; import org.hibernate.Hibernate; @@ -37,10 +38,9 @@ public void tearDown() throws Exception { // [Issue#93], backwards compatible case @Test public void testNoReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate4Module() + final ObjectMapper mapper = hibernateMapper(new Hibernate4Module() .configure(Hibernate4Module.Feature.FORCE_LAZY_LOADING, true) - ).enableDefaultTyping(); + ); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -60,7 +60,7 @@ public void testNoReplacePersistentCollection() throws Exception { boolean exceptionThrown = false; try { - Map stuff = mapper.readValue(json, Map.class); + /*Map stuff =*/ mapper.readValue(json, Map.class); } catch (JsonMappingException e) { exceptionThrown = true; } @@ -70,11 +70,9 @@ public void testNoReplacePersistentCollection() throws Exception { // [Issue#93], backwards compatible case @Test public void testReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate4Module() + final ObjectMapper mapper = hibernateMapper(new Hibernate4Module() .configure(Hibernate4Module.Feature.FORCE_LAZY_LOADING, true) - .configure(Hibernate4Module.Feature.REPLACE_PERSISTENT_COLLECTIONS, true) - ).enableDefaultTyping(); + .configure(Hibernate4Module.Feature.REPLACE_PERSISTENT_COLLECTIONS, true)); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -99,7 +97,7 @@ public void testReplacePersistentCollection() throws Exception { boolean issue94failed = false; try { - Map stuff = mapper.readValue(json, Map.class); + /* Map stuff =*/ mapper.readValue(json, Map.class); } catch (JsonMappingException e) { issue94failed = true; } @@ -112,4 +110,11 @@ public void testReplacePersistentCollection() throws Exception { // assertTrue(stuff.containsKey("orders")); // assertNull(stuff.get("orderes")); } + + private ObjectMapper hibernateMapper(Hibernate4Module module) { + return JsonMapper.builder() + .addModule(module) + .build() + .enableDefaultTyping(); + } } diff --git a/hibernate4/src/test/resources/classicmodels.sql b/hibernate4/src/test/resources/classicmodels.sql index 4a5147e8..0b2aa506 100644 --- a/hibernate4/src/test/resources/classicmodels.sql +++ b/hibernate4/src/test/resources/classicmodels.sql @@ -33,16 +33,16 @@ CREATE TABLE `classicmodels`.`Customer` ( `contactFirstName` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50), `city` varchar(50) NOT NULL, - `state` varchar(50) DEFAULT NULL, - `postalCode` varchar(15) DEFAULT NULL, + `state` varchar(50), + `postalCode` varchar(15) , `country` varchar(50) NOT NULL, - `salesRepEmployeeNumber` int(11) DEFAULT NULL, - `creditLimit` double DEFAULT NULL, - `missingProductCode` varchar(50) NULL, + `salesRepEmployeeNumber` int(11), + `creditLimit` double, + `missingProductCode` varchar(50), PRIMARY KEY (`customerNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`) VALUES (103,'Atelier graphique','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000), (112,'Signal Gift Stores','King','Sue','7025551838','8489 Strong St.',NULL,'Las Vegas','NV','83030','USA',1166,71800), @@ -168,7 +168,7 @@ INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contact (496,'Kellys Gift Shop','Snowden','Tony','+64 9 5555500','Arenales 1938 3A',NULL,'Auckland ',NULL,'','New Zealand',1612,110000); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`, `missingProductCode`) VALUES (500,'Customer with valid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'S10_1678'), - (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'), + (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'); DROP TABLE IF EXISTS `classicmodels`.`Employee`; CREATE TABLE `classicmodels`.`Employee` ( @@ -178,10 +178,10 @@ CREATE TABLE `classicmodels`.`Employee` ( `extension` varchar(10) NOT NULL, `email` varchar(100) NOT NULL, `officeCode` varchar(50) NOT NULL, - `reportsTo` int(11) DEFAULT NULL, + `reportsTo` int(11) , `jobTitle` varchar(50) NOT NULL, PRIMARY KEY (`employeeNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Employee` (`employeeNumber`,`lastName`,`firstName`,`extension`,`email`,`officeCode`,`reportsTo`,`jobTitle`) VALUES (1002,'Murphy','Diane','x5800','dmurphy@classicmodelcars.com','1',NULL,'President'), (1056,'Patterson','Mary','x4611','mpatterso@classicmodelcars.com','1',1002,'VP Sales'), @@ -213,13 +213,13 @@ CREATE TABLE `classicmodels`.`Office` ( `city` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, - `state` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50) , + `state` varchar(50) , `country` varchar(50) NOT NULL, `postalCode` varchar(10) NOT NULL, `territory` varchar(10) NOT NULL, PRIMARY KEY (`officeCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Office` (`officeCode`,`city`,`phone`,`addressLine1`,`addressLine2`,`state`,`country`,`postalCode`,`territory`) VALUES ('1','San Francisco','+1 650 219 4782','100 Market Street','Suite 300','CA','USA','94080','NA'), ('2','Boston','+1 215 837 0825','1550 Court Place','Suite 102','MA','USA','02107','NA'), @@ -234,12 +234,12 @@ CREATE TABLE `classicmodels`.`Order` ( `orderNumber` int(11) NOT NULL, `orderDate` datetime NOT NULL, `requiredDate` datetime NOT NULL, - `shippedDate` datetime DEFAULT NULL, + `shippedDate` datetime , `status` varchar(15) NOT NULL, `comments` text, `customerNumber` int(11) NOT NULL, PRIMARY KEY (`orderNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Order` (`orderNumber`,`orderDate`,`requiredDate`,`shippedDate`,`status`,`comments`,`customerNumber`) VALUES (10100,'2003-01-06 00:00:00','2003-01-13 00:00:00','2003-01-10 00:00:00','Shipped',NULL,363), (10101,'2003-01-09 00:00:00','2003-01-18 00:00:00','2003-01-11 00:00:00','Shipped','Check on availability.',128), @@ -576,7 +576,7 @@ CREATE TABLE `classicmodels`.`OrderDetail` ( `priceEach` double NOT NULL, `orderLineNumber` smallint(6) NOT NULL, PRIMARY KEY (`orderNumber`,`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`OrderDetail` (`orderNumber`,`productCode`,`quantityOrdered`,`priceEach`,`orderLineNumber`) VALUES (10100,'S18_1749',30,171.7,3), (10100,'S18_2248',50,67.8,2), @@ -3583,7 +3583,7 @@ CREATE TABLE `classicmodels`.`Payment` ( `paymentDate` datetime NOT NULL, `amount` double NOT NULL, PRIMARY KEY (`customerNumber`,`checkNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Payment` (`customerNumber`,`checkNumber`,`paymentDate`,`amount`) VALUES (103,'HQ336336','2004-10-19 00:00:00',5307.98), (103,'JM555205','2003-06-05 00:00:00',16560.3), @@ -3870,7 +3870,7 @@ CREATE TABLE `classicmodels`.`Product` ( `buyPrice` double NOT NULL, `MSRP` double NOT NULL, PRIMARY KEY (`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Product` (`productCode`,`productName`,`productLine`,`productScale`,`productVendor`,`productDescription`,`quantityInStock`,`buyPrice`,`MSRP`) VALUES ('S10_1678','1969 Harley Davidson Ultimate Chopper','Motorcycles','1:10','Min Lin Diecast','This replica features working kickstand, front suspension, gear-shift lever, footbrake lever, drive chain, wheels and steering. All parts are particularly delicate due to their precise scale and require special care and attention.',7933,48.81,95.7), ('S10_1949','1952 Alpine Renault 1300','Classic Cars','1:10','Classic Metal Creations','Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.',7305,98.58,214.3), @@ -3989,7 +3989,7 @@ CREATE TABLE `classicmodels`.`Contrato` ( `id` numeric(10) NOT NULL, `numero_contrato` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Contrato` (`id`,`numero_contrato`) VALUES (1, '100001-9'); @@ -3999,7 +3999,7 @@ CREATE TABLE `classicmodels`.`Parcela` ( `numero_parcela` numeric(10) NOT NULL, `contrato_id` numeric(10) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Parcela` (`id`,`numero_parcela`,`contrato_id`) VALUES (1, 1, 1); @@ -4010,7 +4010,7 @@ CREATE TABLE `classicmodels`.`Liquidacao` ( `contrato_id` numeric(10) NOT NULL, `parcela_id` numeric(10) NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Liquidacao` (`id`,`valor_total`,`contrato_id`, `parcela_id`) VALUES (1, 10000, 1, 1); diff --git a/hibernate5-jakarta/src/test/java/com/fasterxml/jackson/datatype/hibernate5/jakarta/ReplacePersistentCollectionTest.java b/hibernate5-jakarta/src/test/java/com/fasterxml/jackson/datatype/hibernate5/jakarta/ReplacePersistentCollectionTest.java index 6fcaf8a3..287a52eb 100644 --- a/hibernate5-jakarta/src/test/java/com/fasterxml/jackson/datatype/hibernate5/jakarta/ReplacePersistentCollectionTest.java +++ b/hibernate5-jakarta/src/test/java/com/fasterxml/jackson/datatype/hibernate5/jakarta/ReplacePersistentCollectionTest.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping; +import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.datatype.hibernate5.jakarta.data.Customer; import com.fasterxml.jackson.datatype.hibernate5.jakarta.data.Payment; @@ -39,10 +40,9 @@ public void tearDown() throws Exception { // [Issue#93], backwards compatible case @Test public void testNoReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate5JakartaModule() + final ObjectMapper mapper = hibernateMapper(new Hibernate5JakartaModule() .configure(Hibernate5JakartaModule.Feature.FORCE_LAZY_LOADING, true) - ).enableDefaultTyping(DefaultTyping.NON_FINAL); + ); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -63,11 +63,10 @@ public void testNoReplacePersistentCollection() throws Exception { // [Issue#93], backwards compatible case @Test public void testReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate5JakartaModule() + final ObjectMapper mapper = hibernateMapper(new Hibernate5JakartaModule() .configure(Hibernate5JakartaModule.Feature.FORCE_LAZY_LOADING, true) .configure(Hibernate5JakartaModule.Feature.REPLACE_PERSISTENT_COLLECTIONS, true) - ).enableDefaultTyping(DefaultTyping.NON_FINAL); + ); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -86,4 +85,11 @@ public void testReplacePersistentCollection() throws Exception { // assertTrue(stuff.containsKey("orders")); // assertNull(stuff.get("orderes")); } + + private ObjectMapper hibernateMapper(Hibernate5JakartaModule module) { + return JsonMapper.builder() + .addModule(module) + .build() + .enableDefaultTyping(DefaultTyping.NON_FINAL); + } } diff --git a/hibernate5-jakarta/src/test/resources/classicmodels.sql b/hibernate5-jakarta/src/test/resources/classicmodels.sql index 4a5147e8..a0dec55f 100644 --- a/hibernate5-jakarta/src/test/resources/classicmodels.sql +++ b/hibernate5-jakarta/src/test/resources/classicmodels.sql @@ -33,16 +33,16 @@ CREATE TABLE `classicmodels`.`Customer` ( `contactFirstName` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50), `city` varchar(50) NOT NULL, - `state` varchar(50) DEFAULT NULL, - `postalCode` varchar(15) DEFAULT NULL, + `state` varchar(50), + `postalCode` varchar(15), `country` varchar(50) NOT NULL, - `salesRepEmployeeNumber` int(11) DEFAULT NULL, - `creditLimit` double DEFAULT NULL, + `salesRepEmployeeNumber` int(11), + `creditLimit` double, `missingProductCode` varchar(50) NULL, PRIMARY KEY (`customerNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`) VALUES (103,'Atelier graphique','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000), (112,'Signal Gift Stores','King','Sue','7025551838','8489 Strong St.',NULL,'Las Vegas','NV','83030','USA',1166,71800), @@ -168,7 +168,7 @@ INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contact (496,'Kellys Gift Shop','Snowden','Tony','+64 9 5555500','Arenales 1938 3A',NULL,'Auckland ',NULL,'','New Zealand',1612,110000); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`, `missingProductCode`) VALUES (500,'Customer with valid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'S10_1678'), - (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'), + (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'); DROP TABLE IF EXISTS `classicmodels`.`Employee`; CREATE TABLE `classicmodels`.`Employee` ( @@ -178,10 +178,10 @@ CREATE TABLE `classicmodels`.`Employee` ( `extension` varchar(10) NOT NULL, `email` varchar(100) NOT NULL, `officeCode` varchar(50) NOT NULL, - `reportsTo` int(11) DEFAULT NULL, + `reportsTo` int(11), `jobTitle` varchar(50) NOT NULL, PRIMARY KEY (`employeeNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Employee` (`employeeNumber`,`lastName`,`firstName`,`extension`,`email`,`officeCode`,`reportsTo`,`jobTitle`) VALUES (1002,'Murphy','Diane','x5800','dmurphy@classicmodelcars.com','1',NULL,'President'), (1056,'Patterson','Mary','x4611','mpatterso@classicmodelcars.com','1',1002,'VP Sales'), @@ -213,13 +213,13 @@ CREATE TABLE `classicmodels`.`Office` ( `city` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, - `state` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50), + `state` varchar(50), `country` varchar(50) NOT NULL, `postalCode` varchar(10) NOT NULL, `territory` varchar(10) NOT NULL, PRIMARY KEY (`officeCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Office` (`officeCode`,`city`,`phone`,`addressLine1`,`addressLine2`,`state`,`country`,`postalCode`,`territory`) VALUES ('1','San Francisco','+1 650 219 4782','100 Market Street','Suite 300','CA','USA','94080','NA'), ('2','Boston','+1 215 837 0825','1550 Court Place','Suite 102','MA','USA','02107','NA'), @@ -234,12 +234,12 @@ CREATE TABLE `classicmodels`.`Order` ( `orderNumber` int(11) NOT NULL, `orderDate` datetime NOT NULL, `requiredDate` datetime NOT NULL, - `shippedDate` datetime DEFAULT NULL, + `shippedDate` datetime, `status` varchar(15) NOT NULL, `comments` text, `customerNumber` int(11) NOT NULL, PRIMARY KEY (`orderNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Order` (`orderNumber`,`orderDate`,`requiredDate`,`shippedDate`,`status`,`comments`,`customerNumber`) VALUES (10100,'2003-01-06 00:00:00','2003-01-13 00:00:00','2003-01-10 00:00:00','Shipped',NULL,363), (10101,'2003-01-09 00:00:00','2003-01-18 00:00:00','2003-01-11 00:00:00','Shipped','Check on availability.',128), @@ -576,7 +576,7 @@ CREATE TABLE `classicmodels`.`OrderDetail` ( `priceEach` double NOT NULL, `orderLineNumber` smallint(6) NOT NULL, PRIMARY KEY (`orderNumber`,`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`OrderDetail` (`orderNumber`,`productCode`,`quantityOrdered`,`priceEach`,`orderLineNumber`) VALUES (10100,'S18_1749',30,171.7,3), (10100,'S18_2248',50,67.8,2), @@ -3583,7 +3583,7 @@ CREATE TABLE `classicmodels`.`Payment` ( `paymentDate` datetime NOT NULL, `amount` double NOT NULL, PRIMARY KEY (`customerNumber`,`checkNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Payment` (`customerNumber`,`checkNumber`,`paymentDate`,`amount`) VALUES (103,'HQ336336','2004-10-19 00:00:00',5307.98), (103,'JM555205','2003-06-05 00:00:00',16560.3), @@ -3870,7 +3870,7 @@ CREATE TABLE `classicmodels`.`Product` ( `buyPrice` double NOT NULL, `MSRP` double NOT NULL, PRIMARY KEY (`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Product` (`productCode`,`productName`,`productLine`,`productScale`,`productVendor`,`productDescription`,`quantityInStock`,`buyPrice`,`MSRP`) VALUES ('S10_1678','1969 Harley Davidson Ultimate Chopper','Motorcycles','1:10','Min Lin Diecast','This replica features working kickstand, front suspension, gear-shift lever, footbrake lever, drive chain, wheels and steering. All parts are particularly delicate due to their precise scale and require special care and attention.',7933,48.81,95.7), ('S10_1949','1952 Alpine Renault 1300','Classic Cars','1:10','Classic Metal Creations','Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.',7305,98.58,214.3), @@ -3989,7 +3989,7 @@ CREATE TABLE `classicmodels`.`Contrato` ( `id` numeric(10) NOT NULL, `numero_contrato` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Contrato` (`id`,`numero_contrato`) VALUES (1, '100001-9'); @@ -3999,7 +3999,7 @@ CREATE TABLE `classicmodels`.`Parcela` ( `numero_parcela` numeric(10) NOT NULL, `contrato_id` numeric(10) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Parcela` (`id`,`numero_parcela`,`contrato_id`) VALUES (1, 1, 1); @@ -4010,13 +4010,11 @@ CREATE TABLE `classicmodels`.`Liquidacao` ( `contrato_id` numeric(10) NOT NULL, `parcela_id` numeric(10) NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Liquidacao` (`id`,`valor_total`,`contrato_id`, `parcela_id`) VALUES (1, 10000, 1, 1); - - -- Return to H2 regular mode SET MODE REGULAR; diff --git a/hibernate5/pom.xml b/hibernate5/pom.xml index 41d390f4..daa06879 100644 --- a/hibernate5/pom.xml +++ b/hibernate5/pom.xml @@ -24,7 +24,7 @@ Hibernate (https://hibernate.org) version 5.x data types. com/fasterxml/jackson/datatype/hibernate5 ${project.groupId}.hibernate5 - 5.3.29.Final + 5.3.37.Final ${project.groupId}.hibernate5 diff --git a/hibernate5/src/test/java/com/fasterxml/jackson/datatype/hibernate5/ReplacePersistentCollectionTest.java b/hibernate5/src/test/java/com/fasterxml/jackson/datatype/hibernate5/ReplacePersistentCollectionTest.java index 3a49175a..fc273228 100644 --- a/hibernate5/src/test/java/com/fasterxml/jackson/datatype/hibernate5/ReplacePersistentCollectionTest.java +++ b/hibernate5/src/test/java/com/fasterxml/jackson/datatype/hibernate5/ReplacePersistentCollectionTest.java @@ -1,10 +1,11 @@ package com.fasterxml.jackson.datatype.hibernate5; -import java.util.Set; +import java.util.*; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping; +import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.datatype.hibernate5.data.Customer; import com.fasterxml.jackson.datatype.hibernate5.data.Payment; import org.hibernate.Hibernate; @@ -38,10 +39,9 @@ public void tearDown() throws Exception { // [Issue#93], backwards compatible case @Test public void testNoReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate5Module() + final ObjectMapper mapper = hibernateMapper(new Hibernate5Module() .configure(Hibernate5Module.Feature.FORCE_LAZY_LOADING, true) - ).enableDefaultTyping(DefaultTyping.NON_FINAL); + ); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -62,11 +62,10 @@ public void testNoReplacePersistentCollection() throws Exception { // [Issue#93], backwards compatible case @Test public void testReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate5Module() + final ObjectMapper mapper = hibernateMapper(new Hibernate5Module() .configure(Hibernate5Module.Feature.FORCE_LAZY_LOADING, true) .configure(Hibernate5Module.Feature.REPLACE_PERSISTENT_COLLECTIONS, true) - ).enableDefaultTyping(DefaultTyping.NON_FINAL); + ); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -75,14 +74,24 @@ public void testReplacePersistentCollection() throws Exception { // should force loading... Set payments = customer.getPayments(); - assertTrue(Hibernate.isInitialized(payments)); - Customer stuff = mapper.readValue(json, Customer.class); - assertNotNull(stuff); + assertTrue(Hibernate.isInitialized(payments)); + Customer stuff = mapper.readValue(json, Customer.class); + assertNotNull(stuff); -// Map stuff = mapper.readValue(json, Map.class); -// -// assertTrue(stuff.containsKey("payments")); -// assertTrue(stuff.containsKey("orders")); -// assertNull(stuff.get("orderes")); + // For debugging? + /* + Map stuff = mapper.readValue(json, Map.class); + + Assert.assertTrue(stuff.containsKey("payments")); + Assert.assertTrue(stuff.containsKey("orders")); + Assert.assertNull(stuff.get("orderes")); + */ + } + + private ObjectMapper hibernateMapper(Hibernate5Module module) { + return JsonMapper.builder() + .addModule(module) + .build() + .enableDefaultTyping(DefaultTyping.NON_FINAL); } } diff --git a/hibernate5/src/test/resources/classicmodels.sql b/hibernate5/src/test/resources/classicmodels.sql index 4a5147e8..a0dec55f 100644 --- a/hibernate5/src/test/resources/classicmodels.sql +++ b/hibernate5/src/test/resources/classicmodels.sql @@ -33,16 +33,16 @@ CREATE TABLE `classicmodels`.`Customer` ( `contactFirstName` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50), `city` varchar(50) NOT NULL, - `state` varchar(50) DEFAULT NULL, - `postalCode` varchar(15) DEFAULT NULL, + `state` varchar(50), + `postalCode` varchar(15), `country` varchar(50) NOT NULL, - `salesRepEmployeeNumber` int(11) DEFAULT NULL, - `creditLimit` double DEFAULT NULL, + `salesRepEmployeeNumber` int(11), + `creditLimit` double, `missingProductCode` varchar(50) NULL, PRIMARY KEY (`customerNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`) VALUES (103,'Atelier graphique','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000), (112,'Signal Gift Stores','King','Sue','7025551838','8489 Strong St.',NULL,'Las Vegas','NV','83030','USA',1166,71800), @@ -168,7 +168,7 @@ INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contact (496,'Kellys Gift Shop','Snowden','Tony','+64 9 5555500','Arenales 1938 3A',NULL,'Auckland ',NULL,'','New Zealand',1612,110000); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`, `missingProductCode`) VALUES (500,'Customer with valid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'S10_1678'), - (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'), + (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'); DROP TABLE IF EXISTS `classicmodels`.`Employee`; CREATE TABLE `classicmodels`.`Employee` ( @@ -178,10 +178,10 @@ CREATE TABLE `classicmodels`.`Employee` ( `extension` varchar(10) NOT NULL, `email` varchar(100) NOT NULL, `officeCode` varchar(50) NOT NULL, - `reportsTo` int(11) DEFAULT NULL, + `reportsTo` int(11), `jobTitle` varchar(50) NOT NULL, PRIMARY KEY (`employeeNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Employee` (`employeeNumber`,`lastName`,`firstName`,`extension`,`email`,`officeCode`,`reportsTo`,`jobTitle`) VALUES (1002,'Murphy','Diane','x5800','dmurphy@classicmodelcars.com','1',NULL,'President'), (1056,'Patterson','Mary','x4611','mpatterso@classicmodelcars.com','1',1002,'VP Sales'), @@ -213,13 +213,13 @@ CREATE TABLE `classicmodels`.`Office` ( `city` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, - `state` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50), + `state` varchar(50), `country` varchar(50) NOT NULL, `postalCode` varchar(10) NOT NULL, `territory` varchar(10) NOT NULL, PRIMARY KEY (`officeCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Office` (`officeCode`,`city`,`phone`,`addressLine1`,`addressLine2`,`state`,`country`,`postalCode`,`territory`) VALUES ('1','San Francisco','+1 650 219 4782','100 Market Street','Suite 300','CA','USA','94080','NA'), ('2','Boston','+1 215 837 0825','1550 Court Place','Suite 102','MA','USA','02107','NA'), @@ -234,12 +234,12 @@ CREATE TABLE `classicmodels`.`Order` ( `orderNumber` int(11) NOT NULL, `orderDate` datetime NOT NULL, `requiredDate` datetime NOT NULL, - `shippedDate` datetime DEFAULT NULL, + `shippedDate` datetime, `status` varchar(15) NOT NULL, `comments` text, `customerNumber` int(11) NOT NULL, PRIMARY KEY (`orderNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Order` (`orderNumber`,`orderDate`,`requiredDate`,`shippedDate`,`status`,`comments`,`customerNumber`) VALUES (10100,'2003-01-06 00:00:00','2003-01-13 00:00:00','2003-01-10 00:00:00','Shipped',NULL,363), (10101,'2003-01-09 00:00:00','2003-01-18 00:00:00','2003-01-11 00:00:00','Shipped','Check on availability.',128), @@ -576,7 +576,7 @@ CREATE TABLE `classicmodels`.`OrderDetail` ( `priceEach` double NOT NULL, `orderLineNumber` smallint(6) NOT NULL, PRIMARY KEY (`orderNumber`,`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`OrderDetail` (`orderNumber`,`productCode`,`quantityOrdered`,`priceEach`,`orderLineNumber`) VALUES (10100,'S18_1749',30,171.7,3), (10100,'S18_2248',50,67.8,2), @@ -3583,7 +3583,7 @@ CREATE TABLE `classicmodels`.`Payment` ( `paymentDate` datetime NOT NULL, `amount` double NOT NULL, PRIMARY KEY (`customerNumber`,`checkNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Payment` (`customerNumber`,`checkNumber`,`paymentDate`,`amount`) VALUES (103,'HQ336336','2004-10-19 00:00:00',5307.98), (103,'JM555205','2003-06-05 00:00:00',16560.3), @@ -3870,7 +3870,7 @@ CREATE TABLE `classicmodels`.`Product` ( `buyPrice` double NOT NULL, `MSRP` double NOT NULL, PRIMARY KEY (`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Product` (`productCode`,`productName`,`productLine`,`productScale`,`productVendor`,`productDescription`,`quantityInStock`,`buyPrice`,`MSRP`) VALUES ('S10_1678','1969 Harley Davidson Ultimate Chopper','Motorcycles','1:10','Min Lin Diecast','This replica features working kickstand, front suspension, gear-shift lever, footbrake lever, drive chain, wheels and steering. All parts are particularly delicate due to their precise scale and require special care and attention.',7933,48.81,95.7), ('S10_1949','1952 Alpine Renault 1300','Classic Cars','1:10','Classic Metal Creations','Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.',7305,98.58,214.3), @@ -3989,7 +3989,7 @@ CREATE TABLE `classicmodels`.`Contrato` ( `id` numeric(10) NOT NULL, `numero_contrato` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Contrato` (`id`,`numero_contrato`) VALUES (1, '100001-9'); @@ -3999,7 +3999,7 @@ CREATE TABLE `classicmodels`.`Parcela` ( `numero_parcela` numeric(10) NOT NULL, `contrato_id` numeric(10) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Parcela` (`id`,`numero_parcela`,`contrato_id`) VALUES (1, 1, 1); @@ -4010,13 +4010,11 @@ CREATE TABLE `classicmodels`.`Liquidacao` ( `contrato_id` numeric(10) NOT NULL, `parcela_id` numeric(10) NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Liquidacao` (`id`,`valor_total`,`contrato_id`, `parcela_id`) VALUES (1, 10000, 1, 1); - - -- Return to H2 regular mode SET MODE REGULAR; diff --git a/hibernate6/pom.xml b/hibernate6/pom.xml index e8b148aa..15b5c685 100644 --- a/hibernate6/pom.xml +++ b/hibernate6/pom.xml @@ -22,7 +22,7 @@ Hibernate (https://hibernate.org/) version 6.x with Jakarta data types. com/fasterxml/jackson/datatype/hibernate6 ${project.groupId}.hibernate6 - 6.2.3.Final + 6.2.33.Final ${project.groupId}.hibernate6 diff --git a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/BaseTest.java b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/BaseTest.java index 2cb237d7..ab63ae61 100644 --- a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/BaseTest.java +++ b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/BaseTest.java @@ -11,14 +11,14 @@ public abstract class BaseTest { protected BaseTest() { - try { - System.out.println(Hibernate6Version.isHibernate6_Plus()); - Logger.getLogger(this.getClass()).info("Testing using hibernate " + Hibernate6Version.getHibernateVersion() + - ", is 6+: " + Hibernate6Version.isHibernate6_Plus()); - } catch (Exception e) { - // Should not happen - throw new RuntimeException(e); - } + try { + System.out.println(Hibernate6Version.isHibernate6_Plus()); + Logger.getLogger(this.getClass()).info("Testing using hibernate " + Hibernate6Version.getHibernateVersion() + + ", is 6+: " + Hibernate6Version.isHibernate6_Plus()); + } catch (Exception e) { + // Should not happen + throw new RuntimeException(e); + } } protected ObjectMapper mapperWithModule(boolean forceLazyLoading) diff --git a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/HibernateTest.java b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/HibernateTest.java index a21d1909..d57b8352 100644 --- a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/HibernateTest.java +++ b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/HibernateTest.java @@ -50,11 +50,10 @@ public void testGetCustomerJson() throws Exception { // TODO: verify assertNotNull(json); - /* - System.out.println("--- JSON ---"); - System.out.println(json); - System.out.println("--- /JSON ---"); - */ + + //System.out.println("--- JSON ---"); + //System.out.println(json); + //System.out.println("--- /JSON ---"); } @Test @@ -69,11 +68,10 @@ public void testAllCustomersJson() throws Exception { // TODO: verify assertNotNull(json); - /* - System.out.println("--- JSON ---"); - System.out.println(json); - System.out.println("--- /JSON ---"); - */ + + //System.out.println("--- JSON ---"); + //System.out.println(json); + // System.out.println("--- /JSON ---"); } /** diff --git a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/LazyLoadingTest.java b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/LazyLoadingTest.java index 32913549..1147afe4 100644 --- a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/LazyLoadingTest.java +++ b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/LazyLoadingTest.java @@ -38,11 +38,10 @@ public void testGetCustomerJson() throws Exception String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(customer); // should not force loading... Set payments = customer.getPayments(); - /* - System.out.println("--- JSON ---"); - System.out.println(json); - System.out.println("--- /JSON ---"); - */ + + //System.out.println("--- JSON ---"); + //System.out.println(json); + //System.out.println("--- /JSON ---"); assertFalse(Hibernate.isInitialized(payments)); // TODO: verify diff --git a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/ReplacePersistentCollectionTest.java b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/ReplacePersistentCollectionTest.java index b4270d3f..6ec6eccc 100644 --- a/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/ReplacePersistentCollectionTest.java +++ b/hibernate6/src/test/java/com/fasterxml/jackson/datatype/hibernate6/ReplacePersistentCollectionTest.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping; +import com.fasterxml.jackson.databind.json.JsonMapper; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; @@ -41,10 +42,9 @@ public void tearDown() throws Exception { // [Issue#93], backwards compatible case @Test public void testNoReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate6Module() + final ObjectMapper mapper = hibernateMapper(new Hibernate6Module() .configure(Hibernate6Module.Feature.FORCE_LAZY_LOADING, true) - ).enableDefaultTyping(DefaultTyping.NON_FINAL); + ); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -65,11 +65,10 @@ public void testNoReplacePersistentCollection() throws Exception { // [Issue#93], backwards compatible case @Test public void testReplacePersistentCollection() throws Exception { - final ObjectMapper mapper = new ObjectMapper() - .registerModule(new Hibernate6Module() + final ObjectMapper mapper = hibernateMapper(new Hibernate6Module() .configure(Hibernate6Module.Feature.FORCE_LAZY_LOADING, true) .configure(Hibernate6Module.Feature.REPLACE_PERSISTENT_COLLECTIONS, true) - ).enableDefaultTyping(DefaultTyping.NON_FINAL); + ); Customer customer = em.find(Customer.class, 103); assertFalse(Hibernate.isInitialized(customer.getPayments())); @@ -88,4 +87,11 @@ public void testReplacePersistentCollection() throws Exception { // assertTrue(stuff.containsKey("orders")); // assertNull(stuff.get("orderes")); } + + private ObjectMapper hibernateMapper(Hibernate6Module module) { + return JsonMapper.builder() + .addModule(module) + .build() + .enableDefaultTyping(DefaultTyping.NON_FINAL); + } } diff --git a/hibernate6/src/test/resources/classicmodels.sql b/hibernate6/src/test/resources/classicmodels.sql index 4a5147e8..a0dec55f 100644 --- a/hibernate6/src/test/resources/classicmodels.sql +++ b/hibernate6/src/test/resources/classicmodels.sql @@ -33,16 +33,16 @@ CREATE TABLE `classicmodels`.`Customer` ( `contactFirstName` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50), `city` varchar(50) NOT NULL, - `state` varchar(50) DEFAULT NULL, - `postalCode` varchar(15) DEFAULT NULL, + `state` varchar(50), + `postalCode` varchar(15), `country` varchar(50) NOT NULL, - `salesRepEmployeeNumber` int(11) DEFAULT NULL, - `creditLimit` double DEFAULT NULL, + `salesRepEmployeeNumber` int(11), + `creditLimit` double, `missingProductCode` varchar(50) NULL, PRIMARY KEY (`customerNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`) VALUES (103,'Atelier graphique','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000), (112,'Signal Gift Stores','King','Sue','7025551838','8489 Strong St.',NULL,'Las Vegas','NV','83030','USA',1166,71800), @@ -168,7 +168,7 @@ INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contact (496,'Kellys Gift Shop','Snowden','Tony','+64 9 5555500','Arenales 1938 3A',NULL,'Auckland ',NULL,'','New Zealand',1612,110000); INSERT INTO `classicmodels`.`Customer` (`customerNumber`,`customerName`,`contactLastName`,`contactFirstName`,`phone`,`addressLine1`,`addressLine2`,`city`,`state`,`postalCode`,`country`,`salesRepEmployeeNumber`,`creditLimit`, `missingProductCode`) VALUES (500,'Customer with valid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'S10_1678'), - (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'), + (501,'Customer with invalid product','Schmitt','Carine ','40.32.2555','54, rue Royale',NULL,'Nantes',NULL,'44000','France',1370,21000, 'X10_1678'); DROP TABLE IF EXISTS `classicmodels`.`Employee`; CREATE TABLE `classicmodels`.`Employee` ( @@ -178,10 +178,10 @@ CREATE TABLE `classicmodels`.`Employee` ( `extension` varchar(10) NOT NULL, `email` varchar(100) NOT NULL, `officeCode` varchar(50) NOT NULL, - `reportsTo` int(11) DEFAULT NULL, + `reportsTo` int(11), `jobTitle` varchar(50) NOT NULL, PRIMARY KEY (`employeeNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Employee` (`employeeNumber`,`lastName`,`firstName`,`extension`,`email`,`officeCode`,`reportsTo`,`jobTitle`) VALUES (1002,'Murphy','Diane','x5800','dmurphy@classicmodelcars.com','1',NULL,'President'), (1056,'Patterson','Mary','x4611','mpatterso@classicmodelcars.com','1',1002,'VP Sales'), @@ -213,13 +213,13 @@ CREATE TABLE `classicmodels`.`Office` ( `city` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `addressLine1` varchar(50) NOT NULL, - `addressLine2` varchar(50) DEFAULT NULL, - `state` varchar(50) DEFAULT NULL, + `addressLine2` varchar(50), + `state` varchar(50), `country` varchar(50) NOT NULL, `postalCode` varchar(10) NOT NULL, `territory` varchar(10) NOT NULL, PRIMARY KEY (`officeCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Office` (`officeCode`,`city`,`phone`,`addressLine1`,`addressLine2`,`state`,`country`,`postalCode`,`territory`) VALUES ('1','San Francisco','+1 650 219 4782','100 Market Street','Suite 300','CA','USA','94080','NA'), ('2','Boston','+1 215 837 0825','1550 Court Place','Suite 102','MA','USA','02107','NA'), @@ -234,12 +234,12 @@ CREATE TABLE `classicmodels`.`Order` ( `orderNumber` int(11) NOT NULL, `orderDate` datetime NOT NULL, `requiredDate` datetime NOT NULL, - `shippedDate` datetime DEFAULT NULL, + `shippedDate` datetime, `status` varchar(15) NOT NULL, `comments` text, `customerNumber` int(11) NOT NULL, PRIMARY KEY (`orderNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Order` (`orderNumber`,`orderDate`,`requiredDate`,`shippedDate`,`status`,`comments`,`customerNumber`) VALUES (10100,'2003-01-06 00:00:00','2003-01-13 00:00:00','2003-01-10 00:00:00','Shipped',NULL,363), (10101,'2003-01-09 00:00:00','2003-01-18 00:00:00','2003-01-11 00:00:00','Shipped','Check on availability.',128), @@ -576,7 +576,7 @@ CREATE TABLE `classicmodels`.`OrderDetail` ( `priceEach` double NOT NULL, `orderLineNumber` smallint(6) NOT NULL, PRIMARY KEY (`orderNumber`,`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`OrderDetail` (`orderNumber`,`productCode`,`quantityOrdered`,`priceEach`,`orderLineNumber`) VALUES (10100,'S18_1749',30,171.7,3), (10100,'S18_2248',50,67.8,2), @@ -3583,7 +3583,7 @@ CREATE TABLE `classicmodels`.`Payment` ( `paymentDate` datetime NOT NULL, `amount` double NOT NULL, PRIMARY KEY (`customerNumber`,`checkNumber`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Payment` (`customerNumber`,`checkNumber`,`paymentDate`,`amount`) VALUES (103,'HQ336336','2004-10-19 00:00:00',5307.98), (103,'JM555205','2003-06-05 00:00:00',16560.3), @@ -3870,7 +3870,7 @@ CREATE TABLE `classicmodels`.`Product` ( `buyPrice` double NOT NULL, `MSRP` double NOT NULL, PRIMARY KEY (`productCode`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Product` (`productCode`,`productName`,`productLine`,`productScale`,`productVendor`,`productDescription`,`quantityInStock`,`buyPrice`,`MSRP`) VALUES ('S10_1678','1969 Harley Davidson Ultimate Chopper','Motorcycles','1:10','Min Lin Diecast','This replica features working kickstand, front suspension, gear-shift lever, footbrake lever, drive chain, wheels and steering. All parts are particularly delicate due to their precise scale and require special care and attention.',7933,48.81,95.7), ('S10_1949','1952 Alpine Renault 1300','Classic Cars','1:10','Classic Metal Creations','Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.',7305,98.58,214.3), @@ -3989,7 +3989,7 @@ CREATE TABLE `classicmodels`.`Contrato` ( `id` numeric(10) NOT NULL, `numero_contrato` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Contrato` (`id`,`numero_contrato`) VALUES (1, '100001-9'); @@ -3999,7 +3999,7 @@ CREATE TABLE `classicmodels`.`Parcela` ( `numero_parcela` numeric(10) NOT NULL, `contrato_id` numeric(10) NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Parcela` (`id`,`numero_parcela`,`contrato_id`) VALUES (1, 1, 1); @@ -4010,13 +4010,11 @@ CREATE TABLE `classicmodels`.`Liquidacao` ( `contrato_id` numeric(10) NOT NULL, `parcela_id` numeric(10) NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +); INSERT INTO `classicmodels`.`Liquidacao` (`id`,`valor_total`,`contrato_id`, `parcela_id`) VALUES (1, 10000, 1, 1); - - -- Return to H2 regular mode SET MODE REGULAR; diff --git a/pom.xml b/pom.xml index ee4478e4..2c6538a7 100644 --- a/pom.xml +++ b/pom.xml @@ -60,9 +60,12 @@ + com.h2database h2 - 1.3.156 + 2.3.232 test diff --git a/release-notes/VERSION b/release-notes/VERSION index 51b0cae0..57415cfd 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION @@ -6,7 +6,10 @@ Project: jackson-datatype-hibernate 2.19.0 (not yet released) -- +- Hibernate deps: + * 5.x/JAXB: 5.3.29 -> 5.3.37 + * 6.x: 6.2.3 -> 6.2.33 +- H2 test dependency to 2.3.232 (from 1.3.156) 2.18.2 (27-Nov-2024) 2.18.1 (28-Oct-2024)