- 浏览: 205780 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
wangxin0ldrs:
Exception in thread "main& ...
Javamail发送邮件的简单实例 -
Drakedog:
现在知道是jar包里的,但是好像不是org.apache.cr ...
AJAX大量数据xml格式提交 -
Drakedog:
XmlDocument 这个是要自己写 吗?
AJAX大量数据xml格式提交 -
fashion_518:
楼主是高手吗?
SSH2的包 -
cloverprince:
阿,动态语言的优雅。正在为java+DOM的罗嗦发愁的路过。
解析XML
hibernate-3.2/doc/reference/en/html/mapping.html#mapping-declaration-properties一.Class元素,声明类名与表名加粗部分为最基本的元素<class
name="ClassName" (1)
table="tableName" (2)
discriminator-value="discriminator_value" (3)
mutable="true|false" (4)
schema="owner" (5)
catalog="catalog" (6)
proxy="ProxyInterface" (7)
dynamic-update="true|false" (8)
dynamic-insert="true|false" (9)
select-before-update="true|false" (10)
polymorphism="implicit|explicit" (11)
where="arbitrary sql where condition" (12)
persister="PersisterClass" (13)
batch-size="N" (14)
optimistic-lock="none|version|dirty|all" (15)
lazy="true|false" (16)
entity-name="EntityName" (17)
check="arbitrary sql check condition" (18)
rowid="rowid" (19)
subselect="SQL expression" (20)
abstract="true|false" (21)
node="element-name"
/>以下加粗部分为常用属性 (1) name (optional): The fully qualified Java class name of the persistent class (or interface). If this attribute is missing, it is assumed that the mapping is for a non-POJO entity. (2) table (optional - defaults to the unqualified class name): The name of its database table. (3) discriminator-value (optional - defaults to the class name): A value that distiguishes individual subclasses, used for polymorphic behaviour. Acceptable values include null and not null. (4) mutable (optional, defaults to true): Specifies that instances of the class are (not) mutable. (5) schema (optional): Override the schema name specified by the root <hibernate-mapping> element. (6) catalog (optional): Override the catalog name specified by the root <hibernate-mapping> element. (7) proxy (optional): Specifies an interface to use for lazy initializing proxies. You may specify the name of the class itself. (8) dynamic-update (optional, defaults to false): Specifies that UPDATE SQL should be generated at runtime and contain only those columns whose values have changed. (9) dynamic-insert (optional, defaults to false): Specifies that INSERT SQL should be generated at runtime and contain only the columns whose values are not null. (10) select-before-update (optional, defaults to false): Specifies that Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. In certain cases (actually, only when a transient object has been associated with a new session using update()), this means that Hibernate will perform an extra SQL SELECT to determine if an UPDATE is actually required. (11) polymorphism (optional, defaults to implicit): Determines whether implicit or explicit query polymorphism is used. (12) where (optional) specify an arbitrary SQL WHERE condition to be used when retrieving objects of this class (13) persister (optional): Specifies a custom ClassPersister. (14) batch-size (optional, defaults to 1) specify a "batch size" for fetching instances of this class by identifier. (15) optimistic-lock (optional, defaults to version): Determines the optimistic locking strategy. (16) lazy (optional): Lazy fetching may be completely disabled by setting lazy="false". (17) entity-name (optional, defaults to the class name): Hibernate3 allows a class to be mapped multiple times (to different tables, potentially), and allows entity mappings that are represented by Maps or XML at the Java level. In these cases, you should provide an explicit arbitrary name for the entity. See Section 4.4, “Dynamic models” and Chapter 18, XML Mapping for more information. (18) check (optional): A SQL expression used to generate a multi-row check constraint for automatic schema generation. (19) rowid (optional): Hibernate can use so called ROWIDs on databases which support. E.g. on Oracle, Hibernate can use the rowid extra column for fast updates if you set this option to rowid. A ROWID is an implementation detail and represents the physical location of a stored tuple. (20) subselect (optional): Maps an immutable and read-only entity to a database subselect. Useful if you want to have a view instead of a base table, but don't. See below for more information. (21) abstract (optional): Used to mark abstract superclasses in <union-subclass> hierarchies. 二.ID元素<id name="propertyName" (1) type="typename" (2) column="column_name" (3) unsaved-value="null|any|none|undefined|id_value" (4) access="field|property|ClassName"> (5) node="element-name|@attribute-name|element/@attribute|." <generator class="generatorClass"/></id>(1) name (optional): The name of the identifier property. (2) type (optional): A name that indicates the Hibernate type. (3) column (optional - defaults to the property name): The name of the primary key column. (4) unsaved-value (optional - defaults to a "sensible" value): An identifier property value that indicates that an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session. (5) access (optional - defaults to property): The strategy Hibernate should use for accessing the property value. 三.Generator子元素<id name="id" type="long" column="cat_id"> <generator class="org.hibernate.id.TableHiLoGenerator"> <param name="table">uid_table</param> <param name="column">next_hi_value_column</param> </generator></id>内置标识符生成器increment:适合于代理主键.由Hibernate自动以递增方式生成标识符,每次增量为一identity:适合于代理主键.由底层数据库
name="ClassName" (1)
table="tableName" (2)
discriminator-value="discriminator_value" (3)
mutable="true|false" (4)
schema="owner" (5)
catalog="catalog" (6)
proxy="ProxyInterface" (7)
dynamic-update="true|false" (8)
dynamic-insert="true|false" (9)
select-before-update="true|false" (10)
polymorphism="implicit|explicit" (11)
where="arbitrary sql where condition" (12)
persister="PersisterClass" (13)
batch-size="N" (14)
optimistic-lock="none|version|dirty|all" (15)
lazy="true|false" (16)
entity-name="EntityName" (17)
check="arbitrary sql check condition" (18)
rowid="rowid" (19)
subselect="SQL expression" (20)
abstract="true|false" (21)
node="element-name"
/>以下加粗部分为常用属性 (1) name (optional): The fully qualified Java class name of the persistent class (or interface). If this attribute is missing, it is assumed that the mapping is for a non-POJO entity. (2) table (optional - defaults to the unqualified class name): The name of its database table. (3) discriminator-value (optional - defaults to the class name): A value that distiguishes individual subclasses, used for polymorphic behaviour. Acceptable values include null and not null. (4) mutable (optional, defaults to true): Specifies that instances of the class are (not) mutable. (5) schema (optional): Override the schema name specified by the root <hibernate-mapping> element. (6) catalog (optional): Override the catalog name specified by the root <hibernate-mapping> element. (7) proxy (optional): Specifies an interface to use for lazy initializing proxies. You may specify the name of the class itself. (8) dynamic-update (optional, defaults to false): Specifies that UPDATE SQL should be generated at runtime and contain only those columns whose values have changed. (9) dynamic-insert (optional, defaults to false): Specifies that INSERT SQL should be generated at runtime and contain only the columns whose values are not null. (10) select-before-update (optional, defaults to false): Specifies that Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. In certain cases (actually, only when a transient object has been associated with a new session using update()), this means that Hibernate will perform an extra SQL SELECT to determine if an UPDATE is actually required. (11) polymorphism (optional, defaults to implicit): Determines whether implicit or explicit query polymorphism is used. (12) where (optional) specify an arbitrary SQL WHERE condition to be used when retrieving objects of this class (13) persister (optional): Specifies a custom ClassPersister. (14) batch-size (optional, defaults to 1) specify a "batch size" for fetching instances of this class by identifier. (15) optimistic-lock (optional, defaults to version): Determines the optimistic locking strategy. (16) lazy (optional): Lazy fetching may be completely disabled by setting lazy="false". (17) entity-name (optional, defaults to the class name): Hibernate3 allows a class to be mapped multiple times (to different tables, potentially), and allows entity mappings that are represented by Maps or XML at the Java level. In these cases, you should provide an explicit arbitrary name for the entity. See Section 4.4, “Dynamic models” and Chapter 18, XML Mapping for more information. (18) check (optional): A SQL expression used to generate a multi-row check constraint for automatic schema generation. (19) rowid (optional): Hibernate can use so called ROWIDs on databases which support. E.g. on Oracle, Hibernate can use the rowid extra column for fast updates if you set this option to rowid. A ROWID is an implementation detail and represents the physical location of a stored tuple. (20) subselect (optional): Maps an immutable and read-only entity to a database subselect. Useful if you want to have a view instead of a base table, but don't. See below for more information. (21) abstract (optional): Used to mark abstract superclasses in <union-subclass> hierarchies. 二.ID元素<id name="propertyName" (1) type="typename" (2) column="column_name" (3) unsaved-value="null|any|none|undefined|id_value" (4) access="field|property|ClassName"> (5) node="element-name|@attribute-name|element/@attribute|." <generator class="generatorClass"/></id>(1) name (optional): The name of the identifier property. (2) type (optional): A name that indicates the Hibernate type. (3) column (optional - defaults to the property name): The name of the primary key column. (4) unsaved-value (optional - defaults to a "sensible" value): An identifier property value that indicates that an instance is newly instantiated (unsaved), distinguishing it from detached instances that were saved or loaded in a previous session. (5) access (optional - defaults to property): The strategy Hibernate should use for accessing the property value. 三.Generator子元素<id name="id" type="long" column="cat_id"> <generator class="org.hibernate.id.TableHiLoGenerator"> <param name="table">uid_table</param> <param name="column">next_hi_value_column</param> </generator></id>内置标识符生成器increment:适合于代理主键.由Hibernate自动以递增方式生成标识符,每次增量为一identity:适合于代理主键.由底层数据库
发表评论
-
hibernate 如何实现延迟加载
2011-03-25 15:26 865延迟加载: ... -
基本O/R映射(二)--Hibernate快速参考
2011-03-24 13:14 1031composite-id <composite-id ... -
Spring实例化Bean的三种方式
2010-11-19 15:53 875本文向您介绍Spring实例化Bean的三种方式,包括xml配 ... -
lazy-init属性和预实例化
2010-11-19 14:20 1064最近在负责一个大项目 ... -
可以取得页面参数的 ServletRequestAware接口
2010-11-09 14:05 1009为了在Action处理过程中可以访问到当前请求HttpServ ... -
DAO中的异常处理
2010-06-29 18:57 1152只有在可以合理地预期调用者可以处理异常时,DAO 接口中的方法 ... -
在spring中使用log4j
2010-06-28 14:59 871Log4j是Apache的一个开放源代码项目,通过使用Log4 ... -
struts2中extends='struts-default' 理解
2010-06-25 10:11 3213struts2的struts.xml中package是否必须要 ... -
struts配置的 <package name="tutorial" extends="struts-default">
2010-06-25 10:00 2085<package name="tutorial ... -
Struts2如何使用Spring插件完成整合
2010-06-24 17:51 1502Struts2与Spring的整合,对于程序员很有利,他能使程 ... -
几种获得spring里注册Bean的方法 转载
2010-06-23 14:52 968/** * 获取类型为requiredType的对 ... -
ClassPathXmlApplicationContext 和FileSystemXmlApplicationContext的区别
2010-06-23 10:26 1470classpath: 前缀是不需要的, 默认就是指项目的cla ... -
spring+hibernate架构中Dao访问数据库的几种方法
2010-06-07 13:06 942在spring+hibernate的架构中,访问数据库有几种方 ... -
编程式的事务管理
2010-06-07 12:34 948编程式事务提供了 TransactionTemplate 模板 ... -
好文章
2010-06-07 11:29 719http://wangjie0503.blog.sohu.co ... -
【Spring.事务.异常回滚】请问Spring的声明式事务发生异常时的处理方式。
2010-06-04 15:52 1722http://www.iteye.com/problems/1 ... -
Dao层(hibernate实现)的异常是在Dao层类内处理还是抛到上一层(Service业务层)
2010-06-04 13:58 3448Dao层(hibernate实现)的异 ... -
SSH2的包
2010-06-01 16:41 1281你可能把不要的包也导进去了或是哪个必需的包没导入,以下是必需包 ... -
Struts2 获取request对象的方法
2010-05-31 16:27 1294方法一: 在Action中的代码:Map request ... -
申明式事务和OpenSessionInView
2010-05-25 16:05 826Write operations are not allowe ...
相关推荐
在传统的O/R映射框架中,如Hibernate或MyBatis,开发人员通常需要创建Plain Old Java Objects (POJOs) 并手动维护XML映射文件来定义对象与表之间的关系。然而,Wormhole框架消除了这个需求。它允许开发人员直接使用...
### Hibernate 参考文档知识点概览 #### 一、前言 - **内容简介**:本书是一份关于Hibernate框架的详尽指南,不仅适合初学者入门,同时也可用作专业人士的工具书。 - **特点**:相较于其他中文技术书籍,本书语言...
4.3 Hibernate O/R映射 4.4 数据关联 4.5 Hibernate数据检索 4.6 HQL实用技术 4.7 自定义持久化实现 第5章 Hibernate高级特性 5.1 Hibernate持久化实现 5.2 Hibernate回调与拦截机制 5.3 Hibernate实用技术 ...
4.3 Hibernate O/R映射 4.4 数据关联 4.5 Hibernate数据检索 4.6 HQL实用技术 4.7 自定义持久化实现 第5章 Hibernate高级特性 5.1 Hibernate持久化实现 5.2 Hibernate回调与拦截机制 5.3 Hibernate实用技术 ...
Hibernate是一款开源的对象关系映射(Object/Relational Mapping,ORM)框架,它用于Java语言,并且与Hibernate Search、Hibernate Validator等组件一起为Java EE和Java SE应用程序提供持久化服务。Hibernate不仅...
Hibernate支持一对一、一对多、多对一、多对多等关系映射,通过注解或XML配置实现。理解如何正确配置,可以使数据模型更符合业务需求。 9. **Hibernate查询(HQL)** HQL(Hibernate Query Language)是Hibernate...
描述与标题相同,强调了这是一份针对Hibernate 2.1.2版本的详细中文版参考手册。 ### 重要知识点概述: #### 1. Hibernate简介 - 符合Java习惯的关系数据库持久化 Hibernate是一个开源的对象关系映射(ORM)框架,...
直至Hibernate实战,重点讲述了Hibernate的基础语法、基础配置、O/R映射、数据关联、数据检索、HQL实用技术、自定义持久化实现、Hibernate回调与拦截、Hibernate分页等实用技术,Hibernate实战部分则用一个真实论坛...
- **目的**:通过一个简单的示例,让初学者快速上手Hibernate,理解其基本工作流程。 - **步骤**: 1. 创建Java项目,命名为`hibernate_0100_HelloWorld`。 2. 构建库,添加必要的Hibernate jar包。 3. 引入...
在附录中讲述了Hibernate常用的映射配置,Hibernate工具、XDoclet模板配置以及Hibernate的益友iBatis用法,还以卡片的形式列出了本书中所用的工具及软件,附录最后一部分是“快速启动代码”,供读者对比与参考,...
【hibernate培训ppt】这份53页的资料主要涵盖了对象/关系映射(O/R Mapping)的概念,以及Hibernate框架的入门、映射声明、对象状态与生命周期、查询及最佳实践等内容。对于有一定Java、SQL和JDBC基础,且熟悉面向...
### 马士兵Hibernate学习笔记知识点总结 #### 一、HelloWorld示例 - **目的**:通过简单的示例...通过这些知识点的学习,可以帮助开发者快速掌握Hibernate的基本用法及其高级特性,从而更好地应用于实际项目开发中。
对象/关系数据库映射基础(Basic O/R Mapping)部分,Hibernate映射定义是核心内容之一。映射定义包括了DOCTYPE声明、Hibernate-mapping元素、类映射、属性映射、标识符映射以及如何映射一对多、多对一、一对一、...
此外,还详细说明了基本的O/R映射,包括实体、标识符、属性、嵌入对象、继承策略、关联映射,以及自定义Tuplizers和EntityNameResolvers。 类型和集合映射章节详细解释了Hibernate的各种类型,如基本类型、自定义...
直至Hibernate实战,重点讲述了Hibernate的基础语法、基础配置、O/R映射、数据关联、数据检索、HQL实用技术、自定义持久化实现、Hibernate回调与拦截、Hibernate分页等实用技术,Hibernate实战部分则用一个真实论坛...