5

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

}

}

Muddassir Rahman
  • 976
  • 1
  • 9
  • 20
  • It's currently not possible, there are more details in the link - [Coverters based on multiple attributes](https://stackoverflow.com/questions/25172083/creating-converters-based-on-multiple-attributes-in-jpa-2-1). – Ilya Lapitan Aug 28 '22 at 04:01

0 Answers0