사용자 도구

사이트 도구


java:jpa:converter

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
다음 판 양쪽 다음 판
java:jpa:converter [2018/07/11 14:39]
kwon37xi 만듦
java:jpa:converter [2018/07/11 14:44]
kwon37xi
줄 4: 줄 4:
   * [[http://www.baeldung.com/jpa-attribute-converters|JPA Attribute Converters | Baeldung]]   * [[http://www.baeldung.com/jpa-attribute-converters|JPA Attribute Converters | Baeldung]]
  
 +<code java>
 +@Converter
 +public class PersonNameConverter implements AttributeConverter<PersonName, String> {
 + 
 +    @Override
 +    public String convertToDatabaseColumn(PersonName personName) {
 +        // object to DB column 구현
 +    }
 + 
 +    @Override
 +    public PersonName convertToEntityAttribute(String dbPersonName) {
 +       // DB column to object 구현
 +}
  
 +@Entity(name = "PersonTable")
 +public class Person {
 + 
 +    @Convert(converter = PersonNameConverter.class)
 +    private PersonName personName;
 +     
 +    // ...
 +}
 +</code>
java/jpa/converter.txt · 마지막으로 수정됨: 2022/11/18 15:05 저자 kwon37xi