@Table

pojo 里还是尽量explicitly写一下

@Entity
@Table(name = "user")
public class User implements Serializable{

因为我刚就遇到一个报错,说

can not find table 'db_name.User'...一看就知道它是去数据库里找User这个table。
这个是我在部署到服务器上发生的错误,在我本地就没有这个错误。

我一想以前在bd遇到过的问题,经验,就想起数据库里表名是可以设置大小写敏感的。

可见它是默认去找和pojo一样名字的表去了。

所以我就加了 @Table explicitly指明表名。

猜你喜欢

转载自have-life.iteye.com/blog/1625495