Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data-rest-composite-id/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This example demonstrates how to implement and expose entities with composite ID

== Entity Classes

In this example, we have two entity classes: `Book`[${source-main}/book/Book.java] and `Author`[${source-main}/book/Author.java].
In this example, we have two entity classes: link:{source-main}/book/Book.java[`Book`] and link:{source-main}/book/Author.java[`Author`].
Both use composite IDs implemented as embedded classes.

=== Book Entity
Expand Down
11 changes: 5 additions & 6 deletions docs/modules/ROOT/pages/data-rest-composite-id.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
:source-highlighter: highlight.js
Rashidi Zin <rashidi@zin.my>
1.0, July 13, 2025
:toc:
:nofooter:
:icons: font
:url-quickref: https://github.com/rashidi/spring-boot-tutorials/tree/master/data-rest-composite-id
Expand All @@ -21,7 +20,7 @@ This example demonstrates how to implement and expose entities with composite ID

== Entity Classes

In this example, we have two entity classes: `Book`[${source-main}/book/Book.java] and `Author`[${source-main}/book/Author.java].
In this example, we have two entity classes: link:{source-main}/book/Book.java[`Book`] and link:{source-main}/book/Author.java[`Author`].
Both use composite IDs implemented as embedded classes.

=== Book Entity
Expand Down Expand Up @@ -233,13 +232,13 @@ void create() {
.post().uri("/books")
.content("""
{
"isbn": "9781509827829",
"isbn": "9781402745777",
"title": "The Jungle Book",
"author": "http://localhost/authors/100"
}
""")
.assertThat().headers()
.extracting(LOCATION).asString().isEqualTo("http://localhost/books/9781509827829");
.extracting(LOCATION).asString().isEqualTo("http://localhost/books/9781402745777");
Comment on lines +235 to +241

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change correctly aligns the create() test snippet with the CreateBookTests.java file, it introduces an inconsistency within this documentation page. The create() test now uses ISBN 9781402745777 for "The Jungle Book", while the get() test further down uses 9781509827829 for what appears to be the same book.

This can be confusing for a reader following the tutorial. For a more coherent tutorial, it would be ideal if the underlying test files used consistent data. I'm pointing this out as a potential source of confusion that might be worth addressing in the test code in a future change.

}
----

Expand All @@ -251,8 +250,8 @@ This test creates a Book with an ISBN, title, and author reference, then verifie
----
@Test
@Sql(statements = {
"INSERT INTO author (id, first_name, last_name) VALUES (100, 'Rudyard', 'Kipling')",
"INSERT INTO book (prefix, registration_group, registrant, publication, check_digit, author_id, title) VALUES (978, 1, 509, 82782, 9, 100, 'The Jungle Book')"
"INSERT INTO author (id, first_name, last_name) VALUES (200, 'Rudyard', 'Kipling')",
"INSERT INTO book (prefix, registration_group, registrant, publication, check_digit, author_id, title) VALUES (978, 1, 509, 82782, 9, 200, 'The Jungle Book')"
})
@DisplayName("Given a book is available When I request by its ISBN Then its information should be returned")
void get() {
Expand Down
Loading