hibernate 可选配置
来源:互联网 发布:概率论 知乎 编辑:程序博客网 时间:2024/04/28 21:24
Hibernate Configuration Properties
org.hibernate.dialect.Dialect
which allows Hibernate to generate SQL optimized for a particular relational database.e.g. full.classname.of.Dialect
In most cases Hibernate will actually be able to choose the correct org.hibernate.dialect.Dialect
implementation based on the JDBC metadata
returned by the JDBC driver.
org.hibernate.SQL
to debug
.e.g. true
| false
e.g. true
| false
e.g. SCHEMA_NAME
e.g. CATALOG_NAME
org.hibernate.SessionFactory
will be automatically bound to this name in JNDI after it has been created.e.g. jndi/composite/name
0
disables default outer join fetching.e.g. recommended values between 0
and 3
e.g. recommended values 4
, 8
, 16
SessionFactory
, defaults to pojo
.e.g. dynamic-map
| pojo
e.g. true
| false
e.g. true
| false
e.g. true
| false
false
.e.g. true
| false
@GeneratedValue
. It indicates whether or not the new IdentifierGenerator
implementations are used forjavax.persistence.GenerationType.AUTO
,javax.persistence.GenerationType.TABLE
andjavax.persistence.GenerationType.SEQUENCE
. Default tofalse
to keep backward compatibility.e.g. true
| false
Hibernate JDBC and Connection Properties
Statement.setFetchSize()
).hibernate.jdbc.batch_sizeA non-zero value enables use of JDBC2 batch updates by Hibernate. e.g. recommended values between 5
and 30
true
if your JDBC driver returns correct row counts from executeBatch()
. It is usually safe to turn this option on. Hibernate will then use batched DML for automatically versioned data. Defaults to false
.e.g. true
| false
org.hibernate.jdbc.Batcher
. Most applications will not need this configuration property.e.g. classname.of.BatcherFactory
e.g. true
| false
binary
or serializable
types to/from JDBC. *system-level property*e.g. true
| false
PreparedStatement.getGeneratedKeys()
to retrieve natively generated keys after insert. Requires JDBC3+ driver and JRE1.4+, set to false if your driver has problems with the Hibernate identifier generators. By default, it tries to determine the driver capabilities using connection metadata.e.g. true|false
org.hibernate.connection.ConnectionProvider
which provides JDBC connections to Hibernate.e.g. classname.of.ConnectionProvider
java.sql.Connection
for meaningful values, but note that most databases do not support all isolation levels and some define additional, non-standard isolations.e.g. 1, 2, 4, 8
e.g. true
| false
after_statement
to aggressively release connections after every JDBC call. For a non-JTA connection, it often makes sense to release the connection at the end of each transaction, by usingafter_transaction
. auto
will choose after_statement
for the JTA and CMT transaction strategies andafter_transaction
for the JDBC transaction strategy.e.g. auto
(default) | on_close
| after_transaction
|after_statement
This setting only affects Session
s returned fromSessionFactory.openSession
. For Session
s obtained through SessionFactory.getCurrentSession
, theCurrentSessionContext
implementation configured for use controls the connection release mode for those Session
s. See Section 2.2, “Contextual sessions”
DriverManager.getConnection()
.hibernate.jndi.<propertyName>Pass the property <propertyName> to the JNDIInitialContextFactory
.Hibernate Cache Properties
hibernate.cache.provider_class
The classname of a custom CacheProvider
.e.g. classname.of.CacheProvider
hibernate.cache.use_minimal_puts
Optimizes second-level cache operation to minimize writes, at the cost of more frequent reads. This setting is most useful for clustered caches and, in Hibernate, is enabled by default for clustered cache implementations. e.g. true|false
hibernate.cache.use_query_cache
Enables the query cache. Individual queries still have to be set cachable. e.g. true|false
hibernate.cache.use_second_level_cache
Can be used to completely disable the second level cache, which is enabled by default for classes which specify a <cache>
mapping.e.g. true|false
hibernate.cache.query_cache_factory
The classname of a custom QueryCache
interface, defaults to the built-in StandardQueryCache
.e.g. classname.of.QueryCache
hibernate.cache.region_prefix
A prefix to use for second-level cache region names.e.g. prefix
hibernate.cache.use_structured_entries
Forces Hibernate to store data in the second-level cache in a more human-friendly format. e.g. true|false
hibernate.cache.auto_evict_collection_cache
Enables the automatic eviction of a bi-directional association's collection cache when an element in the ManyToOne collection is added/updated/removed without properly managing the change on the OneToMany side. e.g. true|false
(default: false)
hibernate.cache.default_cache_concurrency_strategy
Setting used to give the name of the defaultorg.hibernate.annotations.CacheConcurrencyStrategy
to use when either @Cacheable
or @Cache
is used.@Cache(strategy="..")
is used to override this default.Hibernate Transaction Properties
hibernate.transaction.factory_class
The classname of a TransactionFactory
to use with Hibernate Transaction
API (defaults toJDBCTransactionFactory
).e.g. classname.of.TransactionFactory
jta.UserTransaction
A JNDI name used by JTATransactionFactory
to obtain the JTA UserTransaction
from the application server.e.g. jndi/composite/name
hibernate.transaction.manager_lookup_class
The classname of a TransactionManagerLookup
. It is required when JVM-level caching is enabled or when using hilo generator in a JTA environment.e.g. classname.of.TransactionManagerLookup
hibernate.transaction.flush_before_completion
If enabled, the session will be automatically flushed during the before completion phase of the transaction. Built-in and automatic session context management is preferred, see Section 2.2, “Contextual sessions”.e.g. true
| false
hibernate.transaction.auto_close_session
If enabled, the session will be automatically closed during the after completion phase of the transaction. Built-in and automatic session context management is preferred, see Section 2.2, “Contextual sessions”.e.g. true
| false
Miscellaneous Properties
hibernate.current_session_context_class
Supply a custom strategy for the scoping of the "current" Session
. SeeSection 2.2, “Contextual sessions” for more information about the built-in strategies.e.g. jta
| thread
| managed
| custom.Class
hibernate.query.factory_class
Chooses the HQL parser implementation. e.g.org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
ororg.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory
hibernate.query.substitutions
Is used to map from tokens in Hibernate queries to SQL tokens (tokens might be function or literal names, for example). e.g.hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC
hibernate.hbm2ddl.auto
Automatically validates or exports schema DDL to the database when the SessionFactory
is created. With create-drop
, the database schema will be dropped when the SessionFactory
is closed explicitly.e.g. validate
| update
| create
| create-drop
hibernate.hbm2ddl.import_files
Comma-separated names of the optional files containing SQL DML statements executed during the SessionFactory
creation. This is useful for testing or demoing: by adding INSERT statements for example you can populate your database with a minimal set of data when it is deployed.
File order matters, the statements of a give file are executed before the statements of the following files. These statements are only executed if the schema is created ie if hibernate.hbm2ddl.auto
is set to create
or create-drop
.
e.g. /humans.sql,/dogs.sql
hibernate.hbm2ddl.import_files_sql_extractor
The classname of a custom ImportSqlCommandExtractor
(defaults to the built-in SingleLineSqlCommandExtractor
). This is useful for implementing dedicated parser that extracts single SQL statements from each import file. Hibernate provides alsoMultipleLinesSqlCommandExtractor
which supports instructions/comments and quoted strings spread over multiple lines (mandatory semicolon at the end of each statement).
e.g. classname.of.ImportSqlCommandExtractor
hibernate.bytecode.use_reflection_optimizer
Enables the use of bytecode manipulation instead of runtime reflection. This is a System-level property and cannot be set inhibernate.cfg.xml
. Reflection can sometimes be useful when troubleshooting. Hibernate always requires javassist even if you turn off the optimizer.
e.g. true
| false
hibernate.bytecode.provider
At the moment, javassist
is the only supported bytecode provider.
e.g. javassist
- hibernate 可选配置
- Hibernate可选的配置属性
- hibernate 可选的配置属性
- hibernate学习笔记--可选的配置属性
- 可选配置
- hibernate实体映射的一些可选优化/配置
- Hibernate的学习之路五(核心可选配置)
- 可选的配置属性(Hibernate reference 3.2.0 ga 正式版中文参考手册)
- 使用update-alternatives工具配置可选系统
- Hibernate的class属性有以下几种可选类型:
- hibernate reverse engineering 中没有可选的java src folder
- TCP/IP 可选配置(ms 文档专门针对 xp 描述 )
- 解决Add Hibernate mapping annotations to POJO (Hibernate 3.2 and above)不可选问题
- hibernate-hibernate的配置
- 【Hibernate】2.Hibernate配置
- Hibernate 配置!
- Hibernate配置
- Hibernate配置
- libevent的使用(socket)
- Unity 3D Polygon Collider2D 使用方法
- UVa12611 - Beautiful Flag
- 从别地方拷贝过来的项目编译问题
- textarea自动适应内容的高度
- hibernate 可选配置
- ffmpeg avcodec_encode_video2 前面10多帧不能实时编码
- web项目学习之sitemesh
- linux之kali系统ssh服务开启
- Android中tabhost选择栏
- C# 城市路网地图生成与运动模拟(一)-数据的获取
- 几个常用的IP地址归属地查询接口
- 用Latex模板写简历
- Andorid使用自定义View实现通讯录,媒体文件等等的ListView的字母索引