package?entity;
import?org.hibernate.Session;
import?org.hibernate.SessionFactory;
import?org.hibernate.cfg.Configuration;
import?org.hibernate.service.ServiceRegistry;
import?org.hibernate.service.ServiceRegistryBuilder;
import?org.hibernate.tool.hbm2ddl.SchemaExport;
import?org.junit.Test;
public?class?TestStudents?{
@Test
public?void?testSchemaExport()
{
//創(chuàng)建配置對象
Configuration?config?=?new?Configuration().configure();
//創(chuàng)建服務(wù)注冊對象
ServiceRegistry?serviceRegistry?=?new?ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
//創(chuàng)建sessionFactory
SessionFactory?sessionFactory?=config.buildSessionFactory(serviceRegistry);
//創(chuàng)建session對象
Session?session??=?sessionFactory.getCurrentSession();
//創(chuàng)建SchemaExport對象
SchemaExport?export?=?new?SchemaExport(config);
export.create(true,true);
}
}上述代碼中,創(chuàng)建服務(wù)注冊對象時出錯:The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files。請大神指教。
添加回答
舉報
0/150
提交
取消