package com.pearson.feedback.domain;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "CoachMark")
public class CoachMark {
@Id
private long coachMarkId;
public long getCoachMarkId() {
return coachMarkId;
}
public void setCoachMarkId(long coachMarkId) {
this.coachMarkId = coachMarkId;
}
}
This is giving me an error of: Table 'Feedback.coach_mark' doesn't exist
这给了我一个错误:表'Feedback.coach_mark'不存在
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'Feedback.coach_mark' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_72]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_72]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_72]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_72]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) ~[mysql-connector-java-5.1.38.jar:5.1.38]
at com.mysql.jdbc.Util.getInstance(Util.java:387) ~[mysql-connector-java-5.1.38.jar:5.1.38]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939) ~[mysql-connector-java-5.1.38.jar:5.1.38]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878) ~[mysql-connector-java-5.1.38.jar:5.1.38]
I can't figure out why it is not using my table name. How would you proceed?
我无法弄清楚为什么它没有使用我的表名。你会怎么做?
2 个解决方案
#1
0
Just add hibernate-jpa-2.0.jar, and try again. it may be due to JPA configuration issue. Then please make sure that the Table name is spelled correctly, since MySQL is using case sensitive table names comparison setting for lower_case_table_names (probably the value '0').
只需添加hibernate-jpa-2.0.jar,然后重试。可能是由于JPA配置问题。然后请确保表名拼写正确,因为MySQL使用了lower_case_table_names的区分大小写的表名比较设置(可能是值'0')。
#2
0
This may be a one of many possible reasons:
这可能是许多可能原因之一:
just check your hibernate.cfg.xml
for hbm2ddl.auto
property
只需检查hibernate.cfg.xml中的hbm2ddl.auto属性
if it is
如果是
<property name="hbm2ddl.auto">create</property>
then change it to
然后改成它
<property name="hibernate.hbm2ddl.auto">create</property>
N.B.: property can be either create
or update
N.B。:属性可以是创建或更新
#1
0
Just add hibernate-jpa-2.0.jar, and try again. it may be due to JPA configuration issue. Then please make sure that the Table name is spelled correctly, since MySQL is using case sensitive table names comparison setting for lower_case_table_names (probably the value '0').
只需添加hibernate-jpa-2.0.jar,然后重试。可能是由于JPA配置问题。然后请确保表名拼写正确,因为MySQL使用了lower_case_table_names的区分大小写的表名比较设置(可能是值'0')。
#2
0
This may be a one of many possible reasons:
这可能是许多可能原因之一:
just check your hibernate.cfg.xml
for hbm2ddl.auto
property
只需检查hibernate.cfg.xml中的hbm2ddl.auto属性
if it is
如果是
<property name="hbm2ddl.auto">create</property>
then change it to
然后改成它
<property name="hibernate.hbm2ddl.auto">create</property>
N.B.: property can be either create
or update
N.B。:属性可以是创建或更新