Hi I'm using the Hibernate 1.2.3(I can't upgrade)
I'm trying to pass the conneciton properties by code ,but with no success.
here is the code
-----------------------------------------------------------------------
Code:
public static java.util.Properties getHibernateProperties(){
pr=new java.util.Properties();
String databasePath=Cafe.class.getResource("User.hbm.xml").getPath();
for (int i=0;i<5;i++){
java.io.File f=new java.io.File(databasePath);
databasePath=f.getParent();
}
databasePath=databasePath+"\\data\\NETCafeDB";
System.out.println(databasePath);
pr.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
pr.setProperty("hibernate.connection.url", "jdbc:hsqldb:"+databasePath);
pr.setProperty("hibernate.connection.username", "sa");
pr.setProperty("hibernate.connection.password", "");
pr.setProperty("hibernate.connection.pool_size", "0");
return pr;
}
-------------------------------------------------------------------------
then
Code:
Datastore ds=Hibernate.createDatastore()
.storeClass(com.NETcafe.core.Objects.Inventory.class)
.storeClass(com.NETcafe.core.Objects.User.class)
.storeClass(com.NETcafe.core.Objects.Computer.class)
.storeClass(com.NETcafe.core.Objects.Customer.class)
.storeClass(com.NETcafe.core.Objects.cardItem.class)
.storeClass(com.NETcafe.core.Objects.NETCardClass.class);
sf= ds.buildSessionFactory(getHibernateProperties());
new SchemaExport(ds).create(true, true);
---------------------------------------------------------
I'm getting all kind of errors form this ,I still have the hibernate.properties file in the class path.