【发布时间】:2014-04-01 20:10:09
【问题描述】:
我正在尝试使用 Hibernate 从数据库中检索我的所有 Things,但出现此错误:
Table 'thingsdb.Things' doesn't exist org.hibernate.exception.SQLGrammarException: could not execute query
数据库中的表实际上命名为things,而不是Things。
我正在执行的查询如下:
List<Thing> listofthings = session.createQuery(" from Thing thing").list();
还有休眠的xml:
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/mythings</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="connection.pool_size">5</property>
<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="show_sql">true</property>
<mapping class="mythings.Thing" />
</session-factory>
</hibernate-configuration>
我试图寻找解决方案,但没有找到。我是 Hibernate 的新手,所以我真的不知道要查找什么或在哪里查找。
【问题讨论】:
标签: java hibernate web-applications