工程创建可参考前文: [学习笔记] 在Eclipse中使用Hibernate,并创建第一个工程,数据库为Oracle XE
在工程上鼠标右键:
找到java 选择 Runable JAR file
Next
点击Finish
打开文件目录 D: mp 会看到一个jar 及 一个子目录,运行jar所依赖的jar文件都在这个子目录之中了。
执行这个jar,打开dos窗口 执行如下命令
cd d: mp
java -jar Hibernate_demo_001.jar
输出内容如下:
十一月 23, 2019 10:57:45 上午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final} 十一月 23, 2019 10:57:45 上午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.5.Final} 十一月 23, 2019 10:57:45 上午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 十一月 23, 2019 10:57:45 上午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 十一月 23, 2019 10:57:45 上午 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 十一月 23, 2019 10:57:45 上午 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 十一月 23, 2019 10:57:45 上午 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 十一月 23, 2019 10:57:45 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) 十一月 23, 2019 10:57:45 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:xe] 十一月 23, 2019 10:57:45 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000046: Connection properties: {user=test, password=****} 十一月 23, 2019 10:57:45 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000006: Autocommit mode: false 十一月 23, 2019 10:57:45 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 (min=1) 十一月 23, 2019 10:57:46 上午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect 十一月 23, 2019 10:57:46 上午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 十一月 23, 2019 10:57:46 上午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory 十一月 23, 2019 10:57:46 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000228: Running hbm2ddl schema update 十一月 23, 2019 10:57:46 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000102: Fetching database metadata 十一月 23, 2019 10:57:46 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000396: Updating schema 十一月 23, 2019 10:57:47 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000261: Table found: TEST.T_EMP 十一月 23, 2019 10:57:47 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000037: Columns: [name, id, salary, age] 十一月 23, 2019 10:57:47 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000108: Foreign keys: [] 十一月 23, 2019 10:57:47 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000126: Indexes: [sys_c007000] 十一月 23, 2019 10:57:47 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000232: Schema update complete Hibernate: select test.hibernate_sequence.nextval from dual Hibernate: insert into test.T_EMP (age, name, salary, id) values (?, ?, ?, ?) 十一月 23, 2019 10:57:47 上午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop INFO: HHH000030: Cleaning up connection pool [jdbc:oracle:thin:@localhost:1521:xe]