I have an annotated entity object with custom table and field names which i use with Spring Data JDBC (not JPA). Smth like:
@Data
@Table("custom_record_table")
public class Record {
@Id
@Column("id_field")
Long id;
String name;
@Column("name_short")
String shortName;
}
I'd like to get a map of properties to fields. Smth like:
{"id":"id_field","name":"name","shortName":"name_short"}
What's the proper way to get it?
For context: I plan to use this map to construct queries to load many-to-one refs along with main table. Now I get this map with plain reflections API scanning for fields and their annotations. It works, but I am feeling like inventing a bicycle...