随笔分类 -  JavaPersistenceWithHibernate第二版笔记

摘要:一、结构 二、代码 1. 2. 3. 不足之处,无论插入还是删除元素,Hibernate都需要update其他元素的位置 阅读全文
posted @ 2016-04-08 18:08 shamgod 阅读(1453) 评论(0) 推荐(0)
摘要:一、结构 A bag is an unordered collection that allows duplicate elements, like the java.util.Collection interface. Curiously, the Java Collections framewo 阅读全文
posted @ 2016-04-08 17:58 shamgod 阅读(386) 评论(0) 推荐(0)
摘要:一、结构 二、代码 1. 2. It doesn’t seem likely that you’d allow the user to attach the same image more than once to the same item, 阅读全文
posted @ 2016-04-08 17:39 shamgod 阅读(1897) 评论(0) 推荐(0)
摘要:一、结构 For example, you can map a class hierarchy to a single table, but, for a particular subclass, switch to a separate table with a foreign key–mappi 阅读全文
posted @ 2016-04-08 11:52 shamgod 阅读(401) 评论(0) 推荐(0)
摘要:一、结构 The fourth option is to represent inheritance relationships as SQL foreign key associations. Every class/subclass that declares persistent proper 阅读全文
posted @ 2016-04-07 22:09 shamgod 阅读(400) 评论(0) 推荐(0)
摘要:一、结构 You can map an entire class hierarchy to a single table. This table includes columns for all properties of all classes in the hierarchy. The valu 阅读全文
posted @ 2016-04-07 21:40 shamgod 阅读(970) 评论(0) 推荐(0)
摘要:一、代码 1. 2. 3. 二、相比上一个方法的优点 1.查询父类不用再通过多次select,而是通过union all,the query select bd from BillingDetails bd generates the following SQL statement: 2.Anoth 阅读全文
posted @ 2016-04-07 21:09 shamgod 阅读(283) 评论(0) 推荐(0)
摘要:一、结构 二、代码 1. 2. 3. 三、存在的问题 1.it doesn’t support polymorphic associations very well。You can’t have another entity mapped with a foreign key “referencin 阅读全文
posted @ 2016-04-07 20:49 shamgod 阅读(230) 评论(0) 推荐(0)
摘要:There are four different strategies for representing an inheritance hierarchy: Use one table per concrete class and default runtime polymorphic behav 阅读全文
posted @ 2016-04-07 20:34 shamgod 阅读(155) 评论(0) 推荐(0)
摘要:一、结构 二、Hibernate支持的UserTypes接口  UserType —You can transform values by interacting with the plain JDBC PreparedStatement (when storing data) and Resul 阅读全文
posted @ 2016-04-07 18:25 shamgod 阅读(1327) 评论(0) 推荐(0)
摘要:一、结构 二、代码 1. 2. 3. 4. 5. 6. 7. 8. 9. 也可以转换集合,If several @Convert annotations are required on a single embedded property, to convert several attributes 阅读全文
posted @ 2016-04-07 17:38 shamgod 阅读(1574) 评论(0) 推荐(0)
摘要:一、简介 1. 2. 3. 4. to override this default mapping. The JPA specification has a convenient shortcut annotation for this purpose, @Lob This maps the byt 阅读全文
posted @ 2016-04-07 14:15 shamgod 阅读(2196) 评论(0) 推荐(0)
摘要:一、数据库 二、代码 1. 2. 3. You can declare @AttributeOverride s at any level, as you do for the name property of the City class, mapping it to the CITY colum 阅读全文
posted @ 2016-04-07 12:22 shamgod 阅读(250) 评论(0) 推荐(0)
摘要:Each @AttributeOverride for a component property is “complete”: any JPA or Hibernate annotation on the overridden property is ignored. This means the 阅读全文
posted @ 2016-04-07 11:41 shamgod 阅读(453) 评论(0) 推荐(0)
摘要:一、数据库 二、代码 1. You should override the equals() and hashCode() methods of Address and compare instances by value. 2. 3. 三、 阅读全文
posted @ 2016-04-07 11:35 shamgod 阅读(199) 评论(0) 推荐(0)

haha