Привет, я загружаю приложение postgresql для загрузки весны, когда я извлекаю всю запись, используя DAO, столбец отображения не существует.Столбец не существует в весеннем загрузочном приложении Postgres
ОШИБКА
WARN : org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 42703
ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ERROR: column merchantit0_.id does not exist
Position: 8
ERROR: org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/customerplus].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/customerplus] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
org.postgresql.util.PSQLException: ERROR: column merchantit0_.id does not exist
Position: 8
Entity Домен
@Entity
@Table(name = "merchant_item_category")
public class MerchantItemCategory{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", nullable = false, length = 11)
private long id;
@ManyToOne
@JoinColumn(name = "merchant_id", nullable = false)
private Merchant merchant;
// getters and setters
}
DAO
public List<MerchantItemCategory> getAllMerchantItemCategoryByMerchantId(long id) {
Session session=getSession();
List<MerchantItemCategory>itemCategories=session.createQuery("from MerchantItemCategory where merchant.id=:merchantId and isDelete='0' order by categoryName asc")
.setParameter("merchantId", id)
.list();
return itemCategories;
}
Я только что проверил каждый OBJ ect и это правильно, Но как эта ошибка возникает ..!
Как говорится об ошибке: таблица «merchant_item_category» не имеет столбец «ID». Создайте его или установите для свойства "hibernate.hbm2ddl.auto" значение "update". – Stefan