【发布时间】:2013-09-14 00:04:08
【问题描述】:
我在我的项目中使用 Hibernate 作为 ORM。我使用 mysql 数据库
我在数据库“目录”中有一个“产品”表。
我已将实体 Products 的 @Table(name="Products",schema="catalog") 注释放在我的应用程序中。
但是,当我尝试运行应用程序时,出现以下异常。你能帮我解决这个问题吗?
Exception:
Exception in thread "main" org.hibernate.HibernateException: Missing table:Products
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1281)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:508)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1769)
at org.eros.purchase.db.utils.HibernateUtil.configure(HibernateUtil.java:17)
at Test.main(Test.java:14)
有什么想法可以解决这个问题吗?
【问题讨论】:
-
识别的缺失表不是产品而是用户。看看那个映射和表格。
-
异常是在谈论不同的缺失表 - 用户
-
检查您作为用户映射的映射类,该类在数据库中不存在
-
我更正了描述。实际上我正在寻找“产品”本身。
-
删除架构试试
标签: java hibernate hibernate-mapping