-1
我該如何硬編碼Hibernate中的配置對象?這是我迄今爲止的;我希望這給你什麼,我試圖做一個要點:硬編碼hibernate.cfg.xml
Configuration config = new Configuration();
config.addAnnotatedClass(GenericMetadatable.class);
config.addAnnotatedClass(SimpleMetadataValue.class);
config.setProperty("connection.driver_class", "org.h2.Driver")
.setProperty("connection.url", "jdbc:h2:~/test")
.setProperty("connection.username", "sa")
.setProperty("connection.password", "")
.setProperty("hibernate.default_schema", "TESTSCHEMA2")
.setProperty("connection.pool_size", "2")
.setProperty("dialect", "org.hibernate.dialect.H2Dialect")
.setProperty("current_session_context_class", "thread")
.setProperty("cache.provider_class", "net.sf.ehcache.hibernate.EhCacheProvider")
.setProperty("show_sql", "true");
config.addProperties(new Properties() {{}});
config.configure();
你能解釋一下你的問題嗎 – Kushan 2012-01-10 02:55:39
-1你沒有說明實際問題是什麼。 – 2013-03-29 12:51:09