On Friday, 6 February 2015 at 08:53:12 UTC, zhmt wrote:
The app compiles fine, but It throw an exception when I try to
save data to mysql :
hibernated.type.MappingException@../../../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!!
IFAIK partial creation does not work. (bug?)
Use db.updateDBSchema( conn, true, true) make sure none of the
entities exist in the database. Otherwise it will fail.
hth.