Why hibernated does not create tables automatically?
zhmt via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 6 00:53:11 PST 2015
The app compiles fine, but It throw an exception when I try to
save data to mysql :
hibernated.type.MappingException at ../../../zhmt/.dub/packages/hibernated-0.2.19/source/hibernated/metadata.d(3332):
Cannot find entity by class ezsockacount.Dao.Customer
My initialization code is something like:
MySQLDriver driver = new MySQLDriver();
string url = MySQLDriver.generateUrl("10.211.55.10", 3306,
"test");
string[string] params = MySQLDriver.setUserAndPassword("root",
"xxx");
ds = new ConnectionPoolDataSourceImpl(driver, url, params);
EntityMetaData schema = new
SchemaInfoImpl!(Customer,Card,Agent);
Dialect dialect = new MySQLDialect();
factory = new SessionFactoryImpl(schema, dialect, ds);
Connection conn = ds.getConnection();
scope(exit) conn.close();
DBInfo db = factory.getDBMetaData();
db.updateDBSchema(conn, false, true);
I checked the "static EntityInfo [] entities; in SchemaInfoImpl",
the length of entites is 0.
And tables in mysql is not created automatically either.
I found the point of this question, but dont know how to resolve
it?
Will anybody help me?
Thx ahead!!
More information about the Digitalmars-d-learn
mailing list