junit執行成功,但沒有在數據庫中生成表
package?com.entity;
import?org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import?org.hibernate.cfg.Configuration;
import?org.hibernate.service.ServiceRegistry;
import?org.hibernate.tool.hbm2ddl.SchemaExport;
import?org.junit.Test;
public?class?TestStudents?{
@Test
public?void?testSchemaExport()?{
//?create?cofig?file
Configuration?config?=?new?Configuration().configure();
SchemaExport?export=new?SchemaExport(config);
export.create(true,?true);
}
}控制臺輸出:
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2016-08-04
已經找到原因了,連數據庫的URL寫錯了
2016-08-04
hibertnate缺jboss-logging這個包