嗨,大家好,我想通过Hibernate将对象保存到MySQL数据库。如果我执行以下代码
User user = new User();
user.setData_1("my data 5");
user.setFirstname("Freddy");
user.setLastname("Bob");
user.setId(5);
session.save(user);
session.getTransaction().commit();
我得到一个
'com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:表'xxx.my_table_1'不存在'
例外。但是,使用相同的配置从相同的表查询就可以了。
可能是什么问题?
最佳答案
在类似hibernate.connection.url = jdbc:postgresql://localhost/mydatabase
之类的配置中检查您的连接字符串。您可能在url(mydatabase)中缺少架构名称。