A unidirectional many-to-one association on a join table is common when the association is optional. For example:
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<join table="PersonAddress"
optional="true">
<key column="personId" unique="true"/>
<many-to-one name="address"
column="addressId"
not-null="true"/>
</join>
</class>
<class name="Address">
<id name="id" column="addressId">
<generator class="native"/>
</id>
</class>
create table Person ( personId bigint not null primary key )
create table PersonAddress ( personId bigint not null primary key, addressId bigint not null )
create table Address ( addressId bigint not null primary key )
ref: https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch08.html
分享到:
相关推荐
使用javax Nullable注解必须使用的jar包
用例子的形式详解了Nullable的用法
Laravel开发-nullable 对对象进行链调用,无论对象是否为空
The 'Numeric Primary Key As Identity' Oracle option is added: if this option is selected, the "StoreGeneratedPattern" will be set to Identity by default for Number primary keys The 'Integer Primary ...
Laravel开发-laravel-nullable Laravel 5-向模型添加可空列
(GOOD,PASS)LINQ TO DATATABLE OR DATASET 完美解决方案,可排除DATASET不支持System.Nullable错误,并为GRIDVIEW增加空行.txt
在django的model中建立了如下的类 class UserType(models.Model): name = models.CharField(max_... usertype = models.ForeignKey(UserType, related_name='user_type', verbose_name=u'用户类型', on_delete=models
The latest C# update added many new features that help you get more done in less time, and this book is your ideal guide for getting up to speed quickly. C# 7 focuses on data consumption, code ...
The latest C# update added many new features that help you get more done in less time, and this book is your ideal guide for getting up to speed quickly. C# 7 focuses on data consumption, code ...
java运行依赖jar包
An isolation level determines the degree to which data is isolated for use by one process and guarded against interference from other processes. Prior to SQL Server 7.0, REPEATABLE READ and ...
The latest C# update added many new features that help you get more done in less time, and this book is your ideal guide for getting up to speed quickly. C# 7 focuses on data consumption, code ...
Laravel开发-nullable .zip
Designed for experienced programmers, this book provides many code examples to help you work with the nuts and bolts of C#, such as generics, LINQ, and asynchronous programming features. You’ll get ...
2.多对多关系(Many to Many): 14 3.自联接关系: 15 1.双向联接(Two way join): 15 2.三向联接(There way join): 16 3.左外部联接(Left Outer Join): 17 4.投影的Let赋值(Projected let assignment): 17 5.组合...
iOS9新出关键字nonnull,nullable,null_resettable,_Null_unspecified 需要注意的一点只能修饰对象,不能修饰基本数据类型. 虽然在项目的代码编写中不会经常用到,不过在调用苹果系统方法的时候还是会经常遇到,需要做...
'Shining a bright light into many of the dark corners of C# 3.0, this book not only covers the 'how,' but also the 'why,' arming the reader with many field-tested methods for wringing the most from ...
主要介绍了PHP7.1新功能之Nullable Type用法,结合实例形式较为详细的对比分析了Nullable Type类型操作的使用技巧,需要的朋友可以参考下
The latest C# update added many new features that help you get more done in less time, and this book is your ideal guide for getting up to speed quickly. C# 7 focuses on data consumption, code ...