Код: Выделить всё
@Data
public class Quote {
@Id
Long id;
QuoteResponse response;
}
@Data
public class QuoteResponse {
@Id
Long quoteResponseId;
@MappedCollection(idColumn = "quote_response")
public List itemQuoteResponses = new ArrayList();
}
@Data
public class ItemQuoteResponse {
@Id
Long id;
}
Код: Выделить всё
CREATE TABLE quote (
id BIGSERIAL PRIMARY KEY NOT NULL,
}
CREATE TABLE quote_response (
quote_response_id BIGSERIAL PRIMARY KEY NOT NULL,
quote int not null
);
CREATE TABLE item_quote_response (
id BIGSERIAL PRIMARY KEY,
quote_response int not null,
FOREIGN KEY (quote_response) REFERENCES quote_response(quote_response_id),
quote_response_key INTEGER NOT NULL
);
Более запутанными являются журналы отладки:
Код: Выделить всё
2024-09-13T15:38:05.372-04:00 DEBUG 25076 --- [dev] [nio-8080-exec-4] o.s.jdbc.core.JdbcTemplate : Executing prepared SQL statement [SELECT
"item_quote_response"."id" AS "id", "item_quote_response"."status" AS "status",
"item_quote_response"."quote_response_key" AS "quote_response_key" FROM
"item_quote_response" WHERE "item_quote_response"."id" = ? ORDER BY "quote_response_key"]
Кажется, я не могу найти никакой документации, обсуждающей этот тип отношений в данных Spring jdbc, или если я нарушаю какое-то соглашение об именах, которое выполняет автоконфигурацию.
Подробнее здесь: https://stackoverflow.com/questions/789 ... -data-jdbc
Мобильная версия