com.github.drinkjava2.jdialects.annotation.jpa
Annotation Type Convert


@Target(value=FIELD)
@Retention(value=RUNTIME)
public @interface Convert

The value of this Convert annotation point to a class, the implementation of this class will used to convert field value to database column value, and column value to database, for example:

 @Convert(XxxDateConverter.class)
 private Date date;// Tell ORM Tool use XxxDateConverter to do the convert
 
 @Convert(XxxEnumTranslator.class)
 private Enum some1;// Tell ORM Tool use XxxEnumTranslator to do the convert
 
 @Convert()
 private Enum some2; // Tell ORM Tool decide how to do the convert by ORM tool itself
 
 


Optional Element Summary
 String attributeName
          The attributeName element must be specified unless the Convert annotation is on an attribute of basic type or on an element collection of basic type.
 Class<?> converter
          Specifies the converter to be applied.
 boolean disableConversion
          Used to disable an auto-apply or inherited converter.
 Class<?> value
           
 

value

public abstract Class<?> value
Default:
void.class

converter

public abstract Class<?> converter
Specifies the converter to be applied. A value for this element must be specified if multiple converters would otherwise apply.

Default:
void.class

attributeName

public abstract String attributeName
The attributeName element must be specified unless the Convert annotation is on an attribute of basic type or on an element collection of basic type. In these cases, the attributeName element must not be specified.

Default:
""

disableConversion

public abstract boolean disableConversion
Used to disable an auto-apply or inherited converter. If disableConversion is true, the converter element should not be specified.

Default:
false


Copyright © 2019. All rights reserved.