the three strategies:
- table per class hierarchy
- table per subclass
- table per concrete class
1.Table per class hierarchy
Suppose we have an interface Payment with the implementors CreditCardPayment and CashPayment. The table per class hierarchy mapping would display in the following way:
<class name="Payment" table="PAYMENT">
<id name="id" type="long" column="PAYMENT_ID">
<generator class="native"/>
</id>
<discriminator column="PAYMENT_TYPE" type="string"/>
<property name="amount" column="AMOUNT"/>
...
<subclass name="CreditCardPayment" discriminator-value="CREDIT">
<property name="creditCardType" column="CCTYPE"/>
...
</subclass>
<subclass name="CashPayment" discriminator-value="CASH">
...
</subclass>
</class>
Exactly one table is required. There is one limitation of this mapping:columns declared by the subclass cannot have
not null constraints.
分享到:
相关推荐
NULL 博文链接:https://copperfield.iteye.com/blog/1140058
Component and Inheritance Mapping Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/Course-Materials/hibernate.html
How to do various mappings, including one-to-one mapping, many-to-one mapping, collection mapping, component mapping, and inheritance mapping How to use Hibernate Query Language (HQL) How to perform ...
第 10 章 继承映射(Inheritance Mapping) 第 11 章 与对象共事 第 12 章 Read-only entities 第 13 章 事务和并发 第 14 章 拦截器与事件(Interceptors and events) 第 15 章 批量处理(Batch...
9. Inheritance Mapping 9.1. The Three Strategies 9.1.1. Table per class hierarchy 9.1.2. Table per subclass 9.1.3. Table per subclass, using a discriminator 9.1.4. Mixing table per class hierarchy ...
4.2. 实现继承(Inheritance) ............................................... 53 4.3. 实现 equals() 和 hashCode() 方法: ................................... 54 4.4. 动态模型(Dynamic models) ............
1.1.3. The mapping file ...................................................................................... 4 1.1.4. Hibernate configuration ...........................................................
Gene mapping is used in experimental genetics to improve the hardiness or productivity of animals or plants of agricultural value, to explore basic mechanisms of inheritance, or to study animal models...
We show you how to deal with inheritance, collections, and complex class associations. Finally, we discuss integration with legacy database schemas and some mapping strategies that are especially ...
实现继承(Inheritance) 7 实现Equals()和GetHashCode() 7 持久化生命周期(Lifecycle)中的回调(Callbacks) 7 合法性检查(Validatable)回调 7 用属性替代 XML 7 第4章 O/R Mapping基础 7 让我们从一个映射的...
Creating a data model using data annotations attributes, and fluent API for database mapping. Performing basic CRUD operations. Filtering, ordering, and grouping data. Working with related data. ...
technology, is an extended Object Relational Mapping (ORM) technology that makes it easy to tie together the data in your database with the objects in your applications. This is done by abstracting ...
5. 对象/关系数据库映射基础(Basic O/R Mapping); 6. 集合类(Collections)映射; 7. 关联关系映射; 8. 组件(Component)映射; 9. 继承映射(Inheritance Mappings); 10. 与对象共事; 11. 事务和并发; 12. 拦截器与...
TMS Aurelius is an Object-Relational Mapping (ORM) framework. Its purpose is to be the definitive ORM framewok for the Delphi/C++ Builder environment, with full support for data manipulation, complex ...
TMS Aurelius is an Object-Relational Mapping (ORM) framework. Its purpose is to be the definitive ORM framewok for the Delphi environment, with full support for data manipulation, complex and advanced...
实现继承(Inheritance) 4.3. 实现 Equals() 和 GetHashCode() 方法 4.4. 持久化生命周期(Lifecycle)中的回调(Callbacks) 4.5. 合法性验证(IValidatable)回调 5. 对象/关系数据库映射基础(Basic...
inheritance, polymorphism, composition and the .NET collections framework, including generic collections. * Native .NET - NHibernate API uses .NET conventions and idioms * Support for fine-...
inheritance, polymorphism, composition and the .NET collections framework, including generic collections. * Native .NET - NHibernate API uses .NET conventions and idioms * Support for fine-...
inheritance, polymorphism, composition and the .NET collections framework, including generic collections. * Native .NET - NHibernate API uses .NET conventions and idioms * Support for fine-...