Код: Выделить всё
@Entity
@Table(name = "users")
@Getter
@Setter
public class Users{
@Id
@SequenceGenerator(name = "cons_seq", sequenceName = "cons_seq", allocationSize = 100)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cons_seq")
@Column(name = "id", nullable = false)
private Long id;
@Column(name = "created_by")
private String created_by;
}
Код: Выделить всё
@Repository
public interface ProfileRepository extends JpaRepository {
@Query(value = """
INSERT INTO users (id, created_by)
VALUES (nextval('cons_seq'), :createdBy)
""", nativeQuery = true)
void create(@Param("createdBy") String createdBy);
}
.......
public void create(final Profile profile) {
profileRepository.create("test);
}
Причина: org.postgresql.util.PSQLException: Никакие результаты не возвращены запрос.
Запись добавлена в базу данных, но я получаю сообщение об ошибке. Знаете ли вы, как я могу решить эту проблему?
Подробнее здесь: https://stackoverflow.com/questions/791 ... ry-when-sq
Мобильная версия