Skip to content

Conversation

@manfe513
Copy link
Owner

@manfe513 manfe513 commented Jun 4, 2025

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

private String message;
private String details;

public JsonResponse(String message, String details) {

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

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;

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> {

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.

3 participants