`

hibernate 配置常量类Environment

阅读更多
Environment 运行环境的意思,hibernate中org.hibernate.cfg.Environment中定义了加载hibernate配置基本参数的常量。
public static final String CONNECTION_PROVIDER="hibernate.connection.provider_class";
	/**
	 * JDBC driver class
	 */
	public static final String DRIVER ="hibernate.connection.driver_class";
	/**
	 * JDBC transaction isolation level
	 */
	public static final String ISOLATION ="hibernate.connection.isolation";
	/**
	 * JDBC URL
	 */
	public static final String URL ="hibernate.connection.url";
	/**
	 * JDBC user
	 */
	public static final String USER ="hibernate.connection.username";
	/**
	 * JDBC password
	 */
	public static final String PASS ="hibernate.connection.password";
	/**
	 * JDBC autocommit mode
	 */
	public static final String AUTOCOMMIT ="hibernate.connection.autocommit";
	/**
	 * Maximum number of inactive connections for Hibernate's connection pool
	 */
	public static final String POOL_SIZE ="hibernate.connection.pool_size";
	/**
	 * <tt>java.sql.Datasource</tt> JNDI name
	 */
	public static final String DATASOURCE ="hibernate.connection.datasource";
	/**
	 * prefix for arbitrary JDBC connection properties
	 */
	public static final String CONNECTION_PREFIX = "hibernate.connection";

	/**
	 * JNDI initial context class, <tt>Context.INITIAL_CONTEXT_FACTORY</tt>
	 */
	public static final String JNDI_CLASS ="hibernate.jndi.class";
	/**
	 * JNDI provider URL, <tt>Context.PROVIDER_URL</tt>
	 */
	public static final String JNDI_URL ="hibernate.jndi.url";
	/**
	 * prefix for arbitrary JNDI <tt>InitialContext</tt> properties
	 */
	public static final String JNDI_PREFIX = "hibernate.jndi";
	/**
	 * JNDI name to bind to <tt>SessionFactory</tt>
	 */
	public static final String SESSION_FACTORY_NAME = "hibernate.session_factory_name";

	/**
	 * Hibernate SQL {@link org.hibernate.dialect.Dialect} class
	 */
	public static final String DIALECT ="hibernate.dialect";

	/**
	 * {@link org.hibernate.dialect.resolver.DialectResolver} classes to register with the
	 * {@link org.hibernate.dialect.resolver.DialectFactory}
	 */
	public static final String DIALECT_RESOLVERS = "hibernate.dialect_resolvers";

	/**
	 * A default database schema (owner) name to use for unqualified tablenames
	 */
	public static final String DEFAULT_SCHEMA = "hibernate.default_schema";
	/**
	 * A default database catalog name to use for unqualified tablenames
	 */
	public static final String DEFAULT_CATALOG = "hibernate.default_catalog";

	/**
	 * Enable logging of generated SQL to the console
	 */
	public static final String SHOW_SQL ="hibernate.show_sql";
	/**
	 * Enable formatting of SQL logged to the console
	 */
	public static final String FORMAT_SQL ="hibernate.format_sql";
	/**
	 * Add comments to the generated SQL
	 */
	public static final String USE_SQL_COMMENTS ="hibernate.use_sql_comments";
	/**
	 * Maximum depth of outer join fetching
	 */
	public static final String MAX_FETCH_DEPTH = "hibernate.max_fetch_depth";
	/**
	 * The default batch size for batch fetching
	 */
	public static final String DEFAULT_BATCH_FETCH_SIZE = "hibernate.default_batch_fetch_size";
	/**
	 * Use <tt>java.io</tt> streams to read / write binary data from / to JDBC
	 */
	public static final String USE_STREAMS_FOR_BINARY = "hibernate.jdbc.use_streams_for_binary";
	/**
	 * Use JDBC scrollable <tt>ResultSet</tt>s. This property is only necessary when there is
	 * no <tt>ConnectionProvider</tt>, ie. the user is supplying JDBC connections.
	 */
	public static final String USE_SCROLLABLE_RESULTSET = "hibernate.jdbc.use_scrollable_resultset";
	/**
	 * Tells the JDBC driver to attempt to retrieve row Id with the JDBC 3.0 PreparedStatement.getGeneratedKeys()
	 * method. In general, performance will be better if this property is set to true and the underlying
	 * JDBC driver supports getGeneratedKeys().
	 */
	public static final String USE_GET_GENERATED_KEYS = "hibernate.jdbc.use_get_generated_keys";
	/**
	 * Gives the JDBC driver a hint as to the number of rows that should be fetched from the database
	 * when more rows are needed. If <tt>0</tt>, JDBC driver default settings will be used.
	 */
	public static final String STATEMENT_FETCH_SIZE = "hibernate.jdbc.fetch_size";
	/**
	 * Maximum JDBC batch size. A nonzero value enables batch updates.
	 */
	public static final String STATEMENT_BATCH_SIZE = "hibernate.jdbc.batch_size";
	/**
	 * Select a custom batcher.
	 */
	public static final String BATCH_STRATEGY = "hibernate.jdbc.factory_class";
	/**
	 * Should versioned data be included in batching?
	 */
	public static final String BATCH_VERSIONED_DATA = "hibernate.jdbc.batch_versioned_data";
	/**
	 * An XSLT resource used to generate "custom" XML
	 */
	public static final String OUTPUT_STYLESHEET ="hibernate.xml.output_stylesheet";

	/**
	 * Maximum size of C3P0 connection pool
	 */
	public static final String C3P0_MAX_SIZE = "hibernate.c3p0.max_size";
	/**
	 * Minimum size of C3P0 connection pool
	 */
	public static final String C3P0_MIN_SIZE = "hibernate.c3p0.min_size";

	/**
	 * Maximum idle time for C3P0 connection pool
	 */
	public static final String C3P0_TIMEOUT = "hibernate.c3p0.timeout";
	/**
	 * Maximum size of C3P0 statement cache
	 */
	public static final String C3P0_MAX_STATEMENTS = "hibernate.c3p0.max_statements";
	/**
	 * Number of connections acquired when pool is exhausted
	 */
	public static final String C3P0_ACQUIRE_INCREMENT = "hibernate.c3p0.acquire_increment";
	/**
	 * Idle time before a C3P0 pooled connection is validated
	 */
	public static final String C3P0_IDLE_TEST_PERIOD = "hibernate.c3p0.idle_test_period";

	/**
	 * Proxool/Hibernate property prefix
	 */
	public static final String PROXOOL_PREFIX = "hibernate.proxool";
	/**
	 * Proxool property to configure the Proxool Provider using an XML (<tt>/path/to/file.xml</tt>)
	 */
	public static final String PROXOOL_XML = "hibernate.proxool.xml";
	/**
	 * Proxool property to configure the Proxool Provider  using a properties file (<tt>/path/to/proxool.properties</tt>)
	 */
	public static final String PROXOOL_PROPERTIES = "hibernate.proxool.properties";
	/**
	 * Proxool property to configure the Proxool Provider from an already existing pool (<tt>true</tt> / <tt>false</tt>)
	 */
	public static final String PROXOOL_EXISTING_POOL = "hibernate.proxool.existing_pool";
	/**
	 * Proxool property with the Proxool pool alias to use
	 * (Required for <tt>PROXOOL_EXISTING_POOL</tt>, <tt>PROXOOL_PROPERTIES</tt>, or
	 * <tt>PROXOOL_XML</tt>)
	 */
	public static final String PROXOOL_POOL_ALIAS = "hibernate.proxool.pool_alias";

	/**
	 * Enable automatic session close at end of transaction
	 */
	public static final String AUTO_CLOSE_SESSION = "hibernate.transaction.auto_close_session";
	/**
	 * Enable automatic flush during the JTA <tt>beforeCompletion()</tt> callback
	 */
	public static final String FLUSH_BEFORE_COMPLETION = "hibernate.transaction.flush_before_completion";
	/**
	 * Specifies how Hibernate should release JDBC connections.
	 */
	public static final String RELEASE_CONNECTIONS = "hibernate.connection.release_mode";
	/**
	 * Context scoping impl for {@link org.hibernate.SessionFactory#getCurrentSession()} processing.
	 */
	public static final String CURRENT_SESSION_CONTEXT_CLASS = "hibernate.current_session_context_class";
	/**
	 * <tt>TransactionFactory</tt> implementor to use for creating <tt>Transaction</tt>s
	 */
	public static final String TRANSACTION_STRATEGY = "hibernate.transaction.factory_class";
	/**
	 * <tt>TransactionManagerLookup</tt> implementor to use for obtaining the <tt>TransactionManager</tt>
	 */
	public static final String TRANSACTION_MANAGER_STRATEGY = "hibernate.transaction.manager_lookup_class";
	/**
	 * JNDI name of JTA <tt>UserTransaction</tt> object
	 */
	public static final String USER_TRANSACTION = "jta.UserTransaction";

	/**
	 * The <tt>CacheProvider</tt> implementation class
	 */
	public static final String CACHE_PROVIDER = "hibernate.cache.provider_class";

	/**
	 * The {@link org.hibernate.cache.RegionFactory} implementation class
	 */
	public static final String CACHE_REGION_FACTORY = "hibernate.cache.region.factory_class";

	/**
	 * The <tt>CacheProvider</tt> implementation class
	 */
	public static final String CACHE_PROVIDER_CONFIG = "hibernate.cache.provider_configuration_file_resource_path";
	/**
	 * The <tt>CacheProvider</tt> JNDI namespace, if pre-bound to JNDI.
	 */
	public static final String CACHE_NAMESPACE = "hibernate.cache.jndi";
	/**
	 * Enable the query cache (disabled by default)
	 */
	public static final String USE_QUERY_CACHE = "hibernate.cache.use_query_cache";
	/**
	 * The <tt>QueryCacheFactory</tt> implementation class.
	 */
	public static final String QUERY_CACHE_FACTORY = "hibernate.cache.query_cache_factory";
	/**
	 * Enable the second-level cache (enabled by default)
	 */
	public static final String USE_SECOND_LEVEL_CACHE = "hibernate.cache.use_second_level_cache";
	/**
	 * Optimize the cache for mimimal puts instead of minimal gets
	 */
	public static final String USE_MINIMAL_PUTS = "hibernate.cache.use_minimal_puts";
	/**
	 * The <tt>CacheProvider</tt> region name prefix
	 */
	public static final String CACHE_REGION_PREFIX = "hibernate.cache.region_prefix";
	/**
	 * Enable use of structured second-level cache entries
	 */
	public static final String USE_STRUCTURED_CACHE = "hibernate.cache.use_structured_entries";

	/**
	 * Enable statistics collection
	 */
	public static final String GENERATE_STATISTICS = "hibernate.generate_statistics";

	public static final String USE_IDENTIFIER_ROLLBACK = "hibernate.use_identifier_rollback";

	/**
	 * Use bytecode libraries optimized property access
	 */
	public static final String USE_REFLECTION_OPTIMIZER = "hibernate.bytecode.use_reflection_optimizer";

	/**
	 * The classname of the HQL query parser factory
	 */
	public static final String QUERY_TRANSLATOR = "hibernate.query.factory_class";

	/**
	 * A comma-seperated list of token substitutions to use when translating a Hibernate
	 * query to SQL
	 */
	public static final String QUERY_SUBSTITUTIONS = "hibernate.query.substitutions";

	/**
	 * Should named queries be checked during startup (the default is enabled).
	 * <p/>
	 * Mainly intended for test environments.
	 */
	public static final String QUERY_STARTUP_CHECKING = "hibernate.query.startup_check";

	/**
	 * Auto export/update schema using hbm2ddl tool. Valid values are <tt>update</tt>,
	 * <tt>create</tt>, <tt>create-drop</tt> and <tt>validate</tt>.
	 */
	public static final String HBM2DDL_AUTO = "hibernate.hbm2ddl.auto";

	/**
	 * The {@link org.hibernate.exception.SQLExceptionConverter} to use for converting SQLExceptions
	 * to Hibernate's JDBCException hierarchy.  The default is to use the configured
	 * {@link org.hibernate.dialect.Dialect}'s preferred SQLExceptionConverter.
	 */
	public static final String SQL_EXCEPTION_CONVERTER = "hibernate.jdbc.sql_exception_converter";

	/**
	 * Enable wrapping of JDBC result sets in order to speed up column name lookups for
	 * broken JDBC drivers
	 */
	public static final String WRAP_RESULT_SETS = "hibernate.jdbc.wrap_result_sets";

	/**
	 * Enable ordering of update statements by primary key value
	 */
	public static final String ORDER_UPDATES = "hibernate.order_updates";

	/**
	 * Enable ordering of insert statements for the purpose of more effecient JDBC batching.
	 */
	public static final String ORDER_INSERTS = "hibernate.order_inserts";

	/**
	 * The EntityMode in which set the Session opened from the SessionFactory.
	 */
    public static final String DEFAULT_ENTITY_MODE = "hibernate.default_entity_mode";

    /**
     * The jacc context id of the deployment
     */
    public static final String JACC_CONTEXTID = "hibernate.jacc_context_id";

	public static final String BYTECODE_PROVIDER = "hibernate.bytecode.provider";

	public static final String JPAQL_STRICT_COMPLIANCE= "hibernate.query.jpaql_strict_compliance";

上面是从源文件copy出来的常量,Environment是final的常量类,不可以被继承。
分享到:
评论

相关推荐

    Hibernate配置文件加载后修改配置信息

    该文件通常包含以下几类配置信息: - 数据库连接信息(例如:URL、用户名、密码等)。 - 使用的方言(Dialect)。 - 事务管理方式。 - 缓存策略等。 #### 二、反射机制简介 反射机制是Java语言的一个重要特性,它...

    hibernate源码包

    Environment类中定义了一些常量,比如连接数据库所需的属性。 3. **org.hibernate.cache**: 缓存管理相关类,Hibernate支持二级缓存,能够提高数据访问效率。 4. **org.hibernate.dialect**: 存储各种数据库方言的...

    java+struts+hibernate+spring基础面试题

    JRE(Java Runtime Environment)则为运行Java程序提供了必要的环境,包括JVM和核心库。 Java的优点包括简单性、安全性、可移植性、面向对象、健壮性、多线程、体系结构中立、解释执行、高性能、分布式和动态性。...

    java各知识点详细总结(超级经典).doc

    2. **JRE(Java Runtime Environment)**:提供运行Java程序所需的类库和JVM(Java Virtual Machine)。 配置Java环境变量是为了使JDK的工具能在任何目录下执行。主要有两种配置方式:永久配置(通过设置JAVA_HOME...

    java面试题

    1. **初始化**: MyBatis通过XML配置文件或注解创建`SqlSessionFactory`。 2. **会话管理**: 使用`SqlSessionFactory`创建`SqlSession`,后者用于执行SQL语句。 3. **SQL执行**: `SqlSession`负责执行SQL语句,并返回...

    Java 最常见的 200+ 面试题:面试必备.docx

    Java作为一门广泛使用的编程语言,其面试题涵盖了众多的知识点,包括基础概念、容器、多线程、反射、对象拷贝、Web开发、异常处理、网络编程、设计模式以及各种框架如Spring、Hibernate、Mybatis等。以下是对部分...

    Java学习文档.doc

    - **开发环境配置**:安装JDK后,需要配置环境变量如JAVA_HOME、PATH和CLASSPATH,确保系统能够找到Java命令和编译器。 - **Linux命令与相关知识**:虽然Java是跨平台的,但学习一些基本的Linux命令对于开发者来说...

    java必备知识点大全.pdf

    final、finally、finalize三者区别:final用于声明常量,finally用在try-catch-finally语句中表示必须执行的代码块,finalize是Object类的一个方法,垃圾回收器在销毁对象之前会调用它。 Io流的层次结构:Java中Io...

    Java基础教程

    JDK(Java Development Kit)是Java开发的核心工具,包含JRE(Java Runtime Environment)以及开发所需的类库和命令。JRE则仅包含运行Java程序所需的组件,主要由类加载器、字节码验证器和运行时解释器三部分组成。 ...

    Java面试笔记-基础问题篇.docx

    18. **final关键字**:final用于声明常量或防止变量、方法和类被修改。 19. **异常处理**:异常是程序运行时的错误,分为Checked异常(编译时需要处理)和Runtime异常(运行时抛出)。try-catch-finally结构用于...

    javaPPT

    - **枚举**:代替常量类,提供更安全的常量管理。 - **Lambda表达式**:简化匿名内部类,用于函数式编程。 - **Stream API**:处理集合的新方式,支持并行操作。 11. **JVM**: - **内存模型**:堆、栈、方法区...

    Java-Learning-Made-Easy.zip_TEACH

    - 变量和常量:声明、初始化和使用变量,以及常量的概念。 - 运算符:了解各种算术、比较和逻辑运算符的用法。 4. **控制流** - 条件语句:if、if-else、switch-case,用于根据条件执行不同代码块。 - 循环:...

    Java 全套面试题.doc

    JRE(Java Runtime Environment)是Java运行环境,只提供了运行Java程序所需的环境,通常用于运行已编译的Java应用。如果只是运行Java程序,安装JRE即可;若需开发Java程序,则需要JDK。 2. `==`与`equals`的区别:...

    java软件开发工程师面试题

    - **JDK**是Java Development Kit,包含JRE(Java Runtime Environment)、Java编译器`javac`、调试工具和其他开发工具。开发者需要JDK来编写、编译和调试Java程序。 - **JRE**仅提供运行Java程序所需的环境,不...

    74个java面试题,只有题目没有答案

    枚举类型是一种特殊的类,用于定义一组常量。 * 如何使用枚举类型?使用 enum 关键字定义枚举类型。 9. Java 循环语句 * Java 中有哪些种类的循环语句?for循环、while循环、do-while循环等。 10. Java lambda ...

    面试题及答案.docx

    JDK(Java Development Kit)是Java开发运行环境,包含了编译器、调试工具等开发所需组件,而JRE(Java Runtime Environment)仅提供运行Java程序所需的环境,通常用于运行已编译的Java应用程序。JDK包含JRE。 2. ...

    JAVA面试题及答案二百多道

    JRE(Java Runtime Environment)则是Java运行时环境,它包含了运行Java程序所需的Java虚拟机(JVM)、类库以及其他支持文件。简而言之,如果你只是想运行Java程序,安装JRE即可;若需要进行开发工作,就需要安装JDK...

    Java+最常见200+面试题全解析.doc

    final 用于声明不可变的变量、常量、方法或类。对于变量,一旦赋值后不能改变;对于方法,final 使方法不能被子类重写;对于类,final 表示该类不能有子类。 4. **Math.round(-1.5)** 结果: Math.round() 方法会...

    可能是2021年最全最硬核的Java面试 “备战” 资料(暗黑版).pdf

    JRE(Java Runtime Environment)是Java运行环境,仅用于执行Java程序,不需要开发功能。简单来说,运行Java程序只需JRE,而进行开发工作则需JDK。 2. `==`与`equals`的区别:对于基本类型,`==`比较的是数值是否...

Global site tag (gtag.js) - Google Analytics