Hallo Forum,
ich möchte in einem Projekt Hibernate einsetzen, jedoch auf die hibernate.cfg.xml verzichten.
Mein Projekt hat sowieso eine ganz normale Konfigurationsdatei.
Nun habe ich folgendes Versucht:
Funktioniert aber leider nicht.
Als Fehler erhalte ich: The user must supply a JDBC connection.
Ich vermute, dass er die Properties die mit connection beginnen nicht übernimmt.
Weiss jemand wie ich die im Programm setze?
Gruß
Sparrow
ich möchte in einem Projekt Hibernate einsetzen, jedoch auf die hibernate.cfg.xml verzichten.
Mein Projekt hat sowieso eine ganz normale Konfigurationsdatei.
Nun habe ich folgendes Versucht:
Code:
AnnotationConfiguration configuration = new AnnotationConfiguration();
Properties props = new Properties();
props.setProperty("connection.driver_class", driver);
props.setProperty("connection.url", url);
props.setProperty("connection.username", user);
props.setProperty("connection.password", pass);
props.setProperty("hibernate.dialect", dialect);
props.setProperty("hibernate.hbm2ddl.auto", "update");
configuration.setProperties(props);
configuration.buildSettings();
configuration.buildSessionFactory();
Funktioniert aber leider nicht.
Als Fehler erhalte ich: The user must supply a JDBC connection.
Ich vermute, dass er die Properties die mit connection beginnen nicht übernimmt.
Weiss jemand wie ich die im Programm setze?
Gruß
Sparrow