Моя сущность:
Код: Выделить всё
@Entity
@Table(schema = "mainschema")
@XmlRootElement
public class Municipalperson implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(nullable = false)
private Integer id;
@Basic(optional = false)
@Column(name = "municipal_id", nullable = false)
private Integer municipal_id;
@Basic(optional = false)
@Column(nullable = false, length = 60)
private String firstname;
public Municipalperson(Integer id, Integer municipal_id, String firstname) {
this.id = id;
this.municipal_id = municipal_id;
this.firstname = firstname;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getMunicipal_id() {
return municipal_id;
}
public void setMunicipal_id(Integer municipal_id) {
this.municipal_id = municipal_id;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
}
Код: Выделить всё
@Repository
public interface MunicipalpersonRepository extends JpaRepository {
List findByMunicipal_idOrderByLastnameDesc(int municipal_id);
}
Код: Выделить всё
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'municipalpersonRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property municipal found for type Municipalperson!
Наконец, я переименовал муниципальный_ид в муниципальныйId (подчеркивание удалено), а также переименовал геттеры/сеттеры и репозиторий. (
Код: Выделить всё
findByMunicipalIdOrderByLastnameDescМой вопрос: почему это происходит?
Подробнее здесь: https://stackoverflow.com/questions/234 ... olumn-name
Мобильная версия