Fixed the akquisition of a database-connection, if one is needed
[hibernate4-maven-plugin] / src / it / hibernate-lob-converter-bug / src / main / java / io / blep / MyEntity.java
1 package io.blep;
2
3 import javax.persistence.*;
4
5 /**
6  * @author blep
7  */
8 @Entity
9 public class MyEntity {
10     @Id
11     @GeneratedValue(strategy = GenerationType.AUTO)
12     private Integer id;
13
14     @Convert(converter = MyConverter.class)
15     @Lob
16     private String status;
17
18     @Converter
19     public static class MyConverter implements AttributeConverter<String, Integer> {
20
21         @Override
22         public Integer convertToDatabaseColumn(String attribute) {
23             return attribute == null ? 0 : attribute.length();
24         }
25
26         @Override
27         public String convertToEntityAttribute(Integer dbData) {
28             return "";
29         }
30     }
31
32     public Integer getId() {
33         return id;
34     }
35
36     public void setId(Integer id) {
37         this.id = id;
38     }
39
40     public String getStatus() {
41         return status;
42     }
43
44     public void setStatus(String status) {
45         this.status = status;
46     }
47
48 }