Я получаю сообщение об ошибке "column" systementi0_.Id не существует ". Я использую PostgreSql и Hibernate. Есть код моей сущности:
@Entity
@Table(name = "system_table", schema = "blue_schema")
public class SystemEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id", unique = true)
private int id;
@Column(name = "name")
private String name;
@Column(name = "sys_description")
private String systemDescription;
@Column(name = "tech_description")
private String technologyDescritpion;
@Column(name = "owner_name")
private String owner;
public SystemEntity() {
// TODO Auto-generated constructor stub
}
public SystemEntity(int id, String name, String systemDescription, String technologyDescritpion, String owner) {
super();
this.id = id;
this.name = name;
this.systemDescription = systemDescription;
this.technologyDescritpion = technologyDescritpion;
this.owner = owner;
}
public SystemEntity(String name, String systemDescription, String technologyDescritpion, String owner) {
super();
this.name = name;
this.systemDescription = systemDescription;
this.technologyDescritpion = technologyDescritpion;
this.owner = owner;
}
В начале я пытаюсьчтобы получить все данные из этой таблицы из БД.
@Override
public List<SystemEntity> getAllSystems() {
Session currentSession = sessionFactory.getCurrentSession();
Query<SystemEntity> theQuery = currentSession.createQuery("from SystemEntity", SystemEntity.class);
List<SystemEntity> listOfSystems = theQuery.getResultList();
return listOfSystems;
}
Это мои типы баз данных и вывод: Вывод таблицы
ТаблицаТипы
Имя моей схемы уточняется в аннотации @Table, но все еще появляется ошибка:
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/ContractManager] threw exception [Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
org.postgresql.util.PSQLException: Error: columnsystementi0_.id does not exist.
Я видел похожий пост, похожий на мой, но решение было простым, просто добавьте имя схемы в@ Таблица.