hibernate4获取connection

 import org.hibernate.HibernateException;
 import org.hibernate.SessionFactory;
 import org.hibernate.cfg.Configuration;
 import org.hibernate.service.ServiceRegistry;
 import org.hibernate.service.ServiceRegistryBuilder;

                           




    Configuration configuration = null;

SessionFactory sessionFactory = null;
ServiceRegistry serviceRegistry = null;
configuration = new Configuration().configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);



con =SessionFactoryUtils.getDataSource(sessionFactory).getConnection();






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ehcache-1.1.jar (1.1) - EHCache cache - runtime, optional (required if no other cache provider is set) versioncheck.jar (1.0) - version checker - buildtime swarmcache-1.0rc2.jar (1.0rc2) - runtime, optional - runtime, optional jboss-cache.jar (1.2.2 alpha) - TreeCache clustered cache - runtime, optional jgroups-2.2.7.jar (2.2.7) - JGroups multicast library - runtime, optional (required by replicated caches) jta.jar (unknown) - Standard JTA API - runtime, required for standalone operation (outside application server) xml-apis.jar (unknown) - Standard JAXP API - runtime, some SAX parser is required commons-logging-1.0.4.jar (1.0.4) - Commons Logging - runtime, required c3p0-0.9.0.jar (0.9.0) - C3P0 JDBC connection pool - runtime, optional connector.jar (unknown) - Standard JCA API - runtime, optional jboss-system.jar (unknown) - unknown name - runtime, optional (required by TreeCache) asm-attrs.jar (unknown) - ASM bytecode library - runtime, required jacc-1_0-fr.jar (1.0-fr) - JACC Library - runtime, optional checkstyle-all.jar (unknown) - Checkstyle - buildtime log4j-1.2.11.jar (1.2.11) - Log4j Library - runtime, optional junit-3.8.1.jar (3.8.1) - JUnit test framework - buildtime dom4j-1.6.1.jar (1.6.1) - XML configuration & mapping parser - runtime, required antlr-2.7.6rc1.jar (2.7.6rc1) - ANother Tool for Language Recognition (patched with proper context classloading) - runtime, required cglib-2.1.3.jar (2.1.3) - CGLIB bytecode generator - runtime, required jboss-common.jar (unknown) - unknown name - runtime, optional (required by TreeCache) oscache-2.1.jar (2.1) - OpenSymphony OSCache - runtime, optional asm.jar (unknown) - ASM bytecode library - runtime, required ant-launcher-1.6.5.jar (1.6.5) - Ant launcher - buildtime jaas.jar (unknown) - Standard JAAS API - runtime, optional (required by JCA) jdbc2_0-stdext.jar (2.0) - Standard Extension JDBC APIs - runtime, required for standalone operation (outside application server) ant-antlr-1.6.5.jar (1.6.5) - Ant antlr support - buildtime jboss-jmx.jar (unknown) - unknown name - runtime, optional (required by TreeCache) cleanimports.jar (unknown) - cleanimports - buildtime xerces-2.6.2.jar (2.6.2) - SAX parser - runtime, required for JDK < 1.4 jaxen-1.1-beta-7.jar (1.1-beta-7) - Jaxen - universal java xpath engine - runtime, required if you want to deserialize a Configuration to improve startup performance ant-junit-1.6.5.jar (1.6.5) - Ant junit support - buildtime ant-swing-1.6.5.jar (1.6.5) - Ant swing support - buildtime commons-collections-2.1.1.jar (2.1.1) - Commons Collections - runtime, required ant-1.6.5.jar (1.6.5) - Ant core - buildtime proxool-0.8.3.jar (0.8.3) - Proxool JDBC connection pool - runtime, optional concurrent-1.3.2.jar (1.3.2) - unknown name - runtime, optional (required by TreeCache) syndiag2.jar (2.0) - antlr to bnf image generator - buildtime

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值