hibernate使用注解时的工具类
来源:互联网 发布:五笔 知乎 编辑:程序博客网 时间:2024/06/08 06:20
package com.sun.java.utils;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
/**
* @author Dell
* hibernate使用注解时的工具类
*
*/
public class HibernateAnnoaUtils {
private static SessionFactory factory;
// 静态代码块
static {
Configuration cfg = new AnnotationConfiguration().configure();
factory = cfg.buildSessionFactory();
}
// 获取SessionFactory的方法
public SessionFactory getSessionFactory() {
return factory;
}
// 获取session的方法
public Session getSession() {
return factory.openSession();
}
// 私有化构造函数
private HibernateAnnoaUtils() {
}
}
- hibernate使用注解时的工具类
- hibernate 注解的使用
- Hibernate注解的使用
- 使用JPA 注解的Hibernate
- hibernate的简单注解/使用
- hibernate 使用注解的 错误
- hibernate使用注解@Temporal的
- Hibernate注解映射的使用
- hibernate使用xml配置文件时的工具类
- hibernate使用注解时映射主键属性的细节
- 3.hibernate使用注解时发生的异常
- Hibernate中@Formula注解的使用
- hibernate注解属性 Mappedby、cascade 的使用
- 使用Spring的注解实现Hibernate事务管理
- Hibernate使用注解的方式配置
- Hibernate使用注解方式加载实体类
- Hibernate使用注解配置持久化类
- Hibernate中使用注解
- hibernate使用xml配置文件时的工具类
- Android 获取系统自带相机的照片
- ios开发中各种版本、设备的区分
- c语言综合练习一
- c语言综合练习二
- hibernate使用注解时的工具类
- asp.net gridview通用类
- cf 153.div2 B. Unsorting Array
- 324的成绩单出来啦。。。。
- zoj2334-Monkey King(超时)
- cf 153.div2 D. Playing with Permutations
- 安装最新的文泉驿字体[z]
- Python切片索引
- 黑马程序员_java反射机制的学习笔记