Hibernate Configuration() zu (xml-)File

benhaze

Mitglied Platinum
Hallo liebe Entwicklergemeinde!

Kennt jemand von euch eine Möglichkeit, aus einem Configuration-Objekt
eine entsprechende Configurations-Datei zu erzeugen?

Ich erzeuge meine Hibernate-Configuration zur Laufzeit, brauche aber für bestimmte Tools eine hibernate.cfg.xml.

Java:
Configuration cfg = new Configuration();
cfg.setProperty("hibernate.connection.url", getDBUrl());
cfg.setProperty("hibernate.connection.username", getDBUSer());
cfg.setProperty("hibernate.connection.password", getDBPasswd());
 
Habs selber herausgefunden...
Trotzdem danke...

also, einfach hibernate-tool.jar importieren und:

Java:
public void createXMLcfg(Configuration cfg,File p_outputDir)
{
   HibernateConfigurationExporter h = new HibernateConfigurationExporter(cfg, p_outputDir);
   h.start();
}

(Das Daumen nach unten Icon hatte ich aber nicht gewählt...)
 

Neue Beiträge

Zurück