标题:junit测试用例,测试失败
取消只看楼主
JS1020
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2017-6-6
结帖率:0
已结贴  问题点数:10 回复次数:0 
junit测试用例,测试失败
package entity;

import java.util.EnumSet;

import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.schema.TargetType;
import org.junit.Test;
public class TestStudents {
@Test
public void testSchemaExport()
    {
      //创建配置对象
    Configuration config = new Configuration().configure();
    //创建服务注册对象
    ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();
    //创建sessionFactory
    //SessionFactory sessionFactory = config.buildSessionFactory(serviceRegistry);
    //创建session对象
    //Session session = sessionFactory.getCurrentSession();
    //创建SchemaExport对象
    Metadata metadata = new MetadataSources(serviceRegistry).buildMetadata();
    SchemaExport export = new SchemaExport();
    System.out.println(export.toString());
    export.create(EnumSet.of(TargetType.DATABASE), metadata);
    }
}
搜索更多相关主题的帖子: package public import 
2017-06-06 10:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-477679-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.111053 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved