上一页 1 ··· 11 12 13 14 15
摘要: 有两种方法来map composite key. 第一种用@IdClass第二种用@Embeddable,参考链接:http://stackoverflow.com/questions/3585034/how-to-map-a-composite-key-with-hibernate一.@IdCla... 阅读全文
posted @ 2015-03-06 00:57 小张的练习室 阅读(321) 评论(0) 推荐(0)
摘要: 1. Bean@Entity@Table(name = "entities")public class Entities { public enum entityType { location, group; } private entityType locationOrGr... 阅读全文
posted @ 2015-03-05 23:45 小张的练习室 阅读(209) 评论(0) 推荐(0)
摘要: 做项目的时候遇到一个很头疼的报错:Illegal attempt to associate a collection with two opensessions出错原因: 一个Object Version 包含了两个oneTomany关系。在数据库调取出一个version对象时,再用saveOrUp... 阅读全文
posted @ 2015-03-05 22:17 小张的练习室 阅读(326) 评论(0) 推荐(0)
摘要: Hibernate中默认的NamingStrategy不支持调用带有下划线的column name。在hibernate的bean中必须使用camel case。使用ImprovedNamingStrategy可以使hibernate成功map到带有下划线的column name。代码如下: 1. 阅读全文
posted @ 2015-03-05 22:11 小张的练习室 阅读(251) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15