このアプリケーションの前に、データベース接続用のHibernateを使用してJava Webアプリケーションを開発しています。Hibernate 4.3.xを使用しており、データベーステーブルの自動作成に次のコードを使用します。Hibernate 5.2の注釈付きクラスからプログラムでデータベーステーブルを生成する方法
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
私は完全に今何をするか分からない、私の男を助けてください..
このデータベースは使用していますか? –
私はMySqlを使用しています –
完全なスタックトレースを追加してください – Jens