i use hibernate tools to create hibernate configuration file
but name of file always are hibernate.cfg.xml .
but i want generate file with another name , help me please .
i use the java code like this :
String srcPath = "srcPath"; String outputPath = "outputPath";
HibernateToolTask t = new HibernateToolTask();
Project project = new Project(); project.setBaseDir(new File(srcPath));
Path p = new Path(project);
p.add(new Path(project, srcPath)); p.add(new Path(project, outputPath));
t.setClasspath(p);
ConfigurationTask ct = t.createConfiguration();
Configuration cfg = ct.getConfiguration();
cfg.setProperty("hibernate.connection.driver_class", "DRIVER"); cfg.setProperty("hibernate.connection.url", "URL"); cfg.setProperty("hibernate.connection.username","USERNAME"); cfg.setProperty("hibernate.connection.password", "pass");
t.setDestDir(new File(outputPath));
t.createHbm2CfgXml();
AntRunner ar = new AntRunner(); ar.runTask(t, srcPath);
|