zoukankan      html  css  js  c++  java
  • Hibernate!!关于关系映射的测试代码

     1 package com.hb.model;
     2 
     3 import static org.junit.Assert.*;
     4 
     5 import org.hibernate.SessionFactory;
     6 import org.hibernate.cfg.AnnotationConfiguration;
     7 import org.hibernate.tool.hbm2ddl.SchemaExport;
     8 import org.junit.AfterClass;
     9 import org.junit.BeforeClass;
    10 import org.junit.Test;
    11 
    12 public class ORMMappingTest {
    13     private  static  SessionFactory   sessionFactory ; 
    14     
    15     //@BeforeClass
    16     public  static  void  beforeClass(){
    17         sessionFactory  = new  AnnotationConfiguration().configure().buildSessionFactory();
    18     }
    19     
    20 //    @AfterClass
    21     public  static  void  afterClass(){
    22         sessionFactory.close();
    23     }
    24     
    25     
    26 
    27     @Test
    28     public void test() {
    29         new SchemaExport(new  AnnotationConfiguration().configure()).create(true, true);
    30     }
    31     
    32     public static void main(String[] args) {
    33         beforeClass();
    34     }
    35 
    36 }
  • 相关阅读:
    HQL语句中类的别名语法以及作用?
    C#面向对象
    c#异步编程一
    c#接口
    c#Socket通信基本使用
    c#FTP基本使用
    c#XML的基本使用
    c#装箱与拆箱
    c#数组与集合
    c#中for与foreach的使用
  • 原文地址:https://www.cnblogs.com/Mokaffe/p/4171746.html
Copyright © 2011-2022 走看看