Мне нужно обновить запись в базе данных и попробовать использовать этот код, но я вижу эту ошибку: java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: company_id_active of: account.User [update account.User h set h.company_id_active =: ActiveCompanyId where h.user_id =:userId]
User.java
@ManyToOne
@JoinColumn(name = "company_id_active")
@JsonManagedReference
private Company companyActive;
...
Geter,Seter
UserRepositoryImpl.java
public boolean updateActiveCompanyID(int userId, int ActiveCompanyId) {
try {
String SQL= "update User h set h.company_id_active =: ActiveCompanyId where h.user_id =:userId";
Query query = entityManager.createQuery(SQL);
query.setParameter("ActiveCompanyId", ActiveCompanyId);
query.setParameter("userId", userId);
query.executeUpdate();
return true;
} catch (Exception ex) {
MyLogger.logException(ex);
return false;
}
}
Home.java
....
userRepository.updateActiveCompanyID(49,11);
....