X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fit%2Fhibernate-lob-converter-bug%2Fsrc%2Fmain%2Fjava%2Fio%2Fblep%2FMyEntity.java;fp=src%2Fit%2Fhibernate-lob-converter-bug%2Fsrc%2Fmain%2Fjava%2Fio%2Fblep%2FMyEntity.java;h=e8bbd36aab467b78712e798a037a70325cb205f8;hp=0000000000000000000000000000000000000000;hb=653ab8054c9232471c3c1192d5074010f378a067;hpb=dc8cc2c0dc557f62e21607eda7835e658eca19fd diff --git a/src/it/hibernate-lob-converter-bug/src/main/java/io/blep/MyEntity.java b/src/it/hibernate-lob-converter-bug/src/main/java/io/blep/MyEntity.java new file mode 100644 index 00000000..e8bbd36a --- /dev/null +++ b/src/it/hibernate-lob-converter-bug/src/main/java/io/blep/MyEntity.java @@ -0,0 +1,48 @@ +package io.blep; + +import javax.persistence.*; + +/** + * @author blep + */ +@Entity +public class MyEntity { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer id; + + @Convert(converter = MyConverter.class) + @Lob + private String status; + + @Converter + public static class MyConverter implements AttributeConverter { + + @Override + public Integer convertToDatabaseColumn(String attribute) { + return attribute == null ? 0 : attribute.length(); + } + + @Override + public String convertToEntityAttribute(Integer dbData) { + return ""; + } + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + +}