Я запрашиваю БД, чтобы получить результат, но получаю пустой массив
Класс репозитория
@Repository
public interface AppConfigRepository extends CrudRepository<AppConfig, Long> {
@Query("SELECT n FROM AppConfig n WHERE n.appCode = ?1 and n.appVersion = ?2")
List<AppConfig> findByCodeAndVersion(String appCode, String appVersion);
}
Класс таблицы
@Entity
@Table(name = "app_config")
@EntityListeners(AuditingEntityListener.class)
public class AppConfig {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(columnDefinition = "serial")
private long id;
@Column(name = "app_code", nullable = false)
private String appCode;
@Column(name = "app_name", nullable = false)
private String appName;
@Column(name = "api_url", nullable = true)
private String apiUrl;
@Column(name = "db_name", nullable = true)
private String dbName;
@Column(name = "app_version", nullable = false)
private String appVersion;
Функция сопоставления
@RequestMapping(value = "/config", params = { "appCode", "appVersion" }, method = RequestMethod.GET)
public List<AppConfig> getConfig(@RequestParam(value = "appCode", required = true) String appCode,
@RequestParam(value = "appVersion", required = true) String appVersion) {
System.out.println(appCode);
System.out.println(appVersion);
return configRepository.findByCodeAndVersion(appCode, appCode);
}
Вот как я делаю URL
http://localhost:9090/api/v1/config?appCode=MANDL_LIVE&appVersion=12.0
В логах я вижу
select appconfig0_.id as id1_0_, appconfig0_.api_url as api_url2_0_, appconfig0_.app_code as app_code3_0_, appconfig0_.app_name as app_name4_0_, appconfig0_.app_version as app_vers5_0_, appconfig0_.db_name as db_name6_0_ from app_config appconfig0_ where appconfig0_.app_code=? and appconfig0_.app_version=?