How to read other than current attribute values in jpa AttributeConverter

Viewed 56

Is it possible to access other than current annotated attribute in AttributeConverter.

I have a java class having two attributes. Out of two, one is annotated with @Convert.

@Column(name = "CREATION_DATE")
private Long creationDate;

@Column(name = "CARD_DISPLAY_NAME")
@Convert(converter = ConverterCard.class)
private String cardDisplayName;

I want to access the value of creationDate column in the AttributeConverter class for cardDisplayName

@Converter
public class ConverterCard implements AttributeConverter<String, String> {

@Override
public String convertToDatabaseColumn(String attribute) {
    
    //want to access the value of creationDate column
    return null;
}

@Override
public String convertToEntityAttribute(String dbData) {
    
    //want to access the value of creationDate column
   return null

}

}

0 Answers
Related