From: Kai Moritz Date: Sun, 13 Nov 2016 13:59:45 +0000 (+0100) Subject: Added a test-case to proofe, that @Converter and @Lob can be used together X-Git-Tag: hibernate-maven-plugin-2.1.0~12 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=9c3a3b7ece6dfdbe79dad9aa10ce09c2fd34ed42;p=hibernate-maven-plugin Added a test-case to proofe, that @Converter and @Lob can be used together See: https://hibernate.atlassian.net/browse/HHH-9615 --- diff --git a/src/it/lob/create.sql b/src/it/lob/create.sql new file mode 100644 index 00000000..ed04fc4c --- /dev/null +++ b/src/it/lob/create.sql @@ -0,0 +1,7 @@ +create sequence hibernate_sequence start with 1 increment by 1; + + create table MyEntity ( + id integer not null, + status blob, + primary key (id) + ); diff --git a/src/it/lob/pom.xml b/src/it/lob/pom.xml new file mode 100644 index 00000000..bba73bcd --- /dev/null +++ b/src/it/lob/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + de.juplo.tests + lob + jar + 1.0-SNAPSHOT + lob + http://maven.apache.org + + + org.hibernate + hibernate-core + 5.2.4.Final + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.7 + 1.7 + utf8 + true + + + + de.juplo + hibernate-maven-plugin + @project.version@ + + org.hibernate.dialect.H2Dialect + false + true + + + + create + + create + + + + + + + diff --git a/src/it/lob/src/main/java/de/juplo/tests/MyConverter.java b/src/it/lob/src/main/java/de/juplo/tests/MyConverter.java new file mode 100644 index 00000000..1c0e30b3 --- /dev/null +++ b/src/it/lob/src/main/java/de/juplo/tests/MyConverter.java @@ -0,0 +1,26 @@ +package de.juplo.tests; + +import javax.persistence.AttributeConverter; +import javax.persistence.Converter; + + +/** + * Taken from https://hibernate.atlassian.net/browse/HHH-9615 + * @author Kai Moritz + */ +@Converter +public class MyConverter implements AttributeConverter +{ + + @Override + public Integer convertToDatabaseColumn(String attribute) + { + return attribute.length(); + } + + @Override + public String convertToEntityAttribute(Integer dbData) + { + return ""; + } +} diff --git a/src/it/lob/src/main/java/de/juplo/tests/MyEntity.java b/src/it/lob/src/main/java/de/juplo/tests/MyEntity.java new file mode 100644 index 00000000..e3821506 --- /dev/null +++ b/src/it/lob/src/main/java/de/juplo/tests/MyEntity.java @@ -0,0 +1,25 @@ +package de.juplo.tests; + +import javax.persistence.Convert; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Lob; + + +/** + * Taken from https://hibernate.atlassian.net/browse/HHH-9615 + * @author Kai Moritz + */ +@Entity +public class MyEntity { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer id; + + @Convert(converter = MyConverter.class) + @Lob + private String status; + +} diff --git a/src/it/lob/verify.bsh b/src/it/lob/verify.bsh new file mode 100644 index 00000000..ce2e5a56 --- /dev/null +++ b/src/it/lob/verify.bsh @@ -0,0 +1,7 @@ +import de.juplo.test.FileComparator; + + +FileComparator comparator = new FileComparator(basedir); + +if (!comparator.isEqual("create.sql","target/create.sql")) + return false;