Skip to content

Hw28 spring boot#18

Open
manfe513 wants to merge 3 commits into
hw24-webServerfrom
hw28-springBoot
Open

Hw28 spring boot#18
manfe513 wants to merge 3 commits into
hw24-webServerfrom
hw28-springBoot

Conversation

@manfe513
Copy link
Copy Markdown
Owner

@manfe513 manfe513 commented Jun 4, 2025

Результат работы приложения:
image
image
image

private String message;
private String details;

public JsonResponse(String message, String details) {
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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;
Copy link
Copy Markdown

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> {
Copy link
Copy Markdown

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<>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants