Hibernate学习

来源:互联网 发布:软交换网络的结构 编辑:程序博客网 时间:2024/06/08 09:35

log4j配置

# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.log4j.rootLogger=INFO, stdout, logfile,DEBUGlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d %p [%c]:%m%nlog4j.appender.logfile=org.apache.log4j.RollingFileAppenderlog4j.appender.logfile.layout=org.apache.log4j.PatternLayoutlog4j.appender.logfile.File=../interface/logfile.log# Keep three backup files.log4j.appender.logfile.MaxBackupIndex=10log4j.appender.logfile.MaxFileSize=5120KB# Pattern to output: date priority [category] - messagelog4j.appender.logfile.layout.ConversionPattern=%d %p [%c]:%m%n#log4j.logger.org.springframework.samples.petclinic.aspects=DEBUG#=========================================#=   spring framewokr log configuration  =#=========================================log4j.logger.org.springframework = INFO,DEBUGlog4j.logger.com.risetek.tsm.interfaces = INFOlog4j.appender.logfile.encoding=utf-8

Hibernate配置

<?xml version='1.0' encoding='utf-8'?><!DOCTYPE hibernate-configuration PUBLIC        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools.                   --><hibernate-configuration>  <session-factory>    <!--  PostgreSQL connection -->    <property name="connection.url">jdbc:mysql://localhost:3306/testhibernate?useUnicode=true&characterEncoding=utf8</property>    <property name="connection.username">root</property>    <property name="connection.password"></property>    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>    <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>    <!--  MySQL connection       <property name="connection.url">jdbc:mysql://localhost/firsthibernate</property>      <property name="connection.username">root</property>      <property name="connection.driver_class">com.mysql.jdbc.Driver</property>      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>      <property name="connection.password">r</property>    -->    <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>    <!--  thread is the short name for      org.hibernate.context.ThreadLocalSessionContext      and let Hibernate bind the session automatically to the thread    -->    <property name="current_session_context_class">thread</property>    <!-- this will show us all sql statements -->    <property name="hibernate.show_sql">true</property>    <!-- this will create the database tables for us -->    <property name="hibernate.hbm2ddl.auto">update</property>  </session-factory></hibernate-configuration>


0 0
原创粉丝点击