-
Notifications
You must be signed in to change notification settings - Fork 0
Hw28 spring boot #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: hw24-webServer
Are you sure you want to change the base?
Hw28 spring boot #18
Conversation
| private String message; | ||
| private String details; | ||
|
|
||
| public JsonResponse(String message, String details) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
строго говорят, в этом имени Json мало, что значит. Т.е. сериализация с этим классом никак явно не связана.
| import org.springframework.data.relational.core.mapping.Table; | ||
|
|
||
| @Getter | ||
| @Setter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно использовать record-ы
| private String name; | ||
|
|
||
| @Column("client_id") | ||
| private Address address; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MappedCollection можно и на адрес навесить.
| import org.springframework.data.repository.CrudRepository; | ||
| import ru.otus.model.Phone; | ||
|
|
||
| public interface PhoneRepository extends CrudRepository<Phone, Long> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
репозиторий для телефона не нужен, т.к. телефон уже часть агрегата:
@MappedCollection(idColumn = "client_id")
private Set<Phone> phones = new HashSet<>();
Результат работы приложения:


