
Hibernate
kinglyjn
Simple is Beautiful | Eamil:admin@keyllo.com | Welcome: http://www.keyllo.com
展开
-
Hibernate主键生成策略小结
assigned主键由外部程序负责生成,在 save() 之前必须指定一个。Hibernate不负责维护主键生成。与Hibernate和底层数据库都无关,可以跨数据库。在存储对象前,必须要使用主键的setter方法给主键赋值,至于这个值怎么生成,完全由自己决定,这种方法应该尽量避免。<id name="id" column="id"> <generator class="assigned"原创 2017-01-12 18:23:54 · 257 阅读 · 0 评论 -
Hibernate data type conf
实体类public class MultiTypeDemo { private String id; private Integer ii; private Short sht; private Byte bt; private Long lg; private Float flt; private Double dbl; privat原创 2017-01-19 16:22:22 · 382 阅读 · 0 评论 -
Hibernate Set Cascade Example (save, update, delete and delete-orphan)
Cascade is a convenient feature to save the lines of code needed to manage the state of the other side manually.The “Cascade” keyword is often appear on the collection mapping to manage the state of th原创 2017-01-19 16:41:34 · 448 阅读 · 0 评论 -
Hibernate唯一约束
UNIQUE约束可以防止两个记录在一个特定的列具有相同的值。 Customers表中,例如,你可能要防止两个或两个以上的人具有相同的年龄。例子:例如,下面的SQL语句创建一个新的表名为CUSTOMERS,并增加了5列。这里年龄列设置为独一无二的,所以不能有两个记录具有相同的年龄:CREATE TABLE CUSTOMERS( ID INT NOT NULL, NAME VAR原创 2017-01-22 17:53:34 · 4423 阅读 · 0 评论