| D: estoraclelib 放置hibernate的所有jar包 D: estoraclesrc 放置源代码 D: estoracleclasses 编译o玫?代码和hibernate的配置文件(hibernate.properties, log4j.properties, cache.ccf) |
| @rem set hibernate classpath set HIBERNATE_LIB=D: estoraclelib set HIBERNATE_CLASSES=D: estoracleclasses set CLASSPATH=%HIBERNATE_LIB%cglib-asm.jar;%HIBERNATE_LIB%commons-beanutils.jar;%HIBERNATE_LIB%commons-collections.jar;%HIBERNATE_LIB%commons-lang.jar;%HIBERNATE_LIB%commons-logging.jar;%HIBERNATE_LIB%dom4j-full.jar;%HIBERNATE_LIB%hibernate2.jar;%HIBERNATE_LIB%jcs.jar;%HIBERNATE_LIB%log4j-1.2.8.jar;%HIBERNATE_LIB%odmg.jar;%HIBERNATE_CLASSES%;%CLASSPATH% |
| @rem Call Weblogic Server call "C:eaweblogic700serverinstartWLS.cmd" |
| hibernate.dialect net.sf.hibernate.dialect.OracleDialect hibernate.connection.datasource mypool hibernate.connection.provider_class net.sf.hibernate.connection.DatasourceConnectionProvider hibernate.session_factory_name hibernate.session_factory |
| hibernate.jdbc.fetch_size 50 hibernate.jdbc.batch_size 25 |
| package com.fankai; import java.util.Hashtable; import weblogic.common.T3StartupDef; import weblogic.common.T3ServicesDef; import net.sf.hibernate.cfg.Configuration; import net.sf.hibernate.SessionFactory; public class HibernateStartUp implements T3StartupDef { public void setServices(T3ServicesDef services) {} public String startup(String name, Hashtable args) throws Exception { Configuration conf = new Configuration().addClass(Cat.class); SessionFactory sf = conf.buildSessionFactory(); return "Hibernate Startup completed successfully"; } } |
| Configuration conf = new Configuration().addClass(Cat.class); SessionFactory sf = conf.buildSessionFactory(); |
| Bind Name: hibernate Object Class: net.sf.hibernate.impl.SessionFactoryImpl Object Hash Code: 454492 Object To String: net.sf.hibernate.impl.SessionFactoryImpl@6ef5c |
| Context ctx = new InitialContext(); SessionFactory sf = (SessionFactory) ctx.lookup("hibernate/session_factory"); |
| Configuration conf = new Configuration().addClass(Cat.class); SessionFactory sf = conf.buildSessionFactory(); |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/374079/viewspace-131977/ ,如需转载,请注明出处,否则将追究法律责任。