Use Hibernate framework to operate pojo instance, bye bye SQL strings :)

This commit is contained in:
Sola
2015-12-05 01:34:13 +08:00
parent 8d9b8da42f
commit 60b4d9e23e
23 changed files with 494 additions and 334 deletions

View File

@@ -0,0 +1,25 @@
package love.sola.netsupport.enums;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter
public class ISPConverter implements AttributeConverter<ISP, Integer> {
@Override
public Integer convertToDatabaseColumn(ISP attribute) {
if (attribute == null) {
return null;
}
return attribute.id;
}
@Override
public ISP convertToEntityAttribute(Integer dbData) {
if (dbData == null) {
return null;
}
return ISP.fromId(dbData);
}
}