Dear everybody:
I would like to create a SessionFactory without any configuration file. That is, I would like to define the database class (it will be a MysqlDataSource) and its parameters in execution time.
I have been searching a method "configure()" (in Configuration class) with a Properties object as a parameter, but I didn't found it. So i am very lost.
Could anyone give me a very simple example to create a SessionFactory without any configuration file, please? And using datasources (class MysqlDataSource, that implements DataSource interface), not "drivers".
So I would like to know how to continue this source code:
Code:
import javax.sql.DataSource;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
........
MysqlDataSource bd = new MysqlDataSource();
bd.setServerName("localhost");
bd.setPort(3306);
bd.setDatabaseName("test");
bd.setUser("root");
bd.setPassword("");
// Now, I want to obtain a SessionFactory object from this "bd" object,
// without any XML or property configuration file
SessionFactory mySessionFactory = ................
Thank you very much for your help :-)