2

I can't find where to define custom column name for conjunction table in case of many-to-many relationship in spring-data-jdbc.

I extended aggregate example from https://github.com/spring-projects/spring-data-examples in my fork: https://github.com/konstiak/spring-data-examples/commit/2a901bb4d81c35406da393b1368109136ae21f5f.

If the conjuction table has columns [color, lego_set] it works out of box. But I'd like to have custom names for these columns [color_id, lego_set_id]. It's clear for 'color_id'. I can define it by @Column annotation in ColorRef entity. But how can I define that column for LegoSet.id will be stored in 'lego_set_id'?

RESOLVED I just had to define @Column(value = "lego_set_id") on colors field in LegoSet entity.

  • Glad you were able to solve your own question. Please post it as an answer and accept it so others can see immediately that your problem is solved. – Jens Schauder Mar 08 '19 at 13:03

1 Answers1

3

Defining @Column(value = "lego_set_id") on colors field in LegoSet entity resolved the problem.