【发布时间】:2016-10-17 19:34:09
【问题描述】:
我正在使用 Hibernate 开发一个用于数据库连接的 java Web 应用程序,在此应用程序之前我使用的是 Hibernate 4.3.x 并使用以下代码自动创建数据库表
public class TableCreator {
public static void main(String[] args) {
try {
Configuration cfg = new Configuration();
cfg.addAnnotatedClass(AdminMaster.class);
cfg.addAnnotatedClass(CorporateMaster.class);
cfg.addAnnotatedClass(Customer.class);
cfg.addAnnotatedClass(LoginMaster.class);
cfg.addAnnotatedClass(Notifications.class);
cfg.configure();
SchemaExport se = new SchemaExport(cfg);
se.create(true, true);
System.out.println("Table Created!!!");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
现在,当我尝试在 Hibernate 5.2 中使用相同的代码时,以下行在 Netbeans 中显示为红色
SchemaExport se = new SchemaExport(cfg);
se.create(true, true);
显示的错误是:
Schemaexport Class in Schemaexport cannot be applied to given types;
required : no arguments
found :configuration
我现在完全不知道该怎么办,请大家帮帮我..
【问题讨论】:
-
你使用的是哪个数据库?
-
请添加完整的堆栈跟踪
-
stackoverflow.com/questions/32178041/…,这个链接应该对你有帮助。
-
请仔细阅读我的问题,我并不是说我已经运行了代码,我只是说当我将鼠标指向感叹号时,Netbeans 中的行显示为红色,表示出现了一些错误在这些行的开头标记,我看到了这些错误..
-
@DeepakPandey 你能显示导入语句吗?
标签: java hibernate jakarta-ee