Why hibernated does not create tables automatically?
zhmt via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Feb 6 01:42:08 PST 2015
class Card
{
import hibernated.core;
@Id
@Generated
long id;
@UniqueKey
string pwd;
}
MySQLDriver driver = new MySQLDriver();
string url = MySQLDriver.generateUrl("10.211.55.10", 3306,
"test");
string[string] params = MySQLDriver.setUserAndPassword("root",
"xxx");
auto ds = new ConnectionPoolDataSourceImpl(driver, url, params);
EntityMetaData schema = new SchemaInfoImpl!(Card);
Dialect dialect = new MySQLDialect();
auto factory = new SessionFactoryImpl(schema, dialect, ds);
Card c = new Card;
auto s = factory.openSession();
scope(exit) s.close();
s.save(c);
Here is the simplest example, but it complains the same error.
More information about the Digitalmars-d-learn
mailing list