`
fannyxjf
  • 浏览: 105439 次
  • 性别: Icon_minigender_2
  • 来自: 武汉
社区版块
存档分类
最新评论
文章列表
现有实体:Account和Role,Account到Role是多对多的单向关联。 需求:查找拥有某个特定Role的Account,即类似于:from Account a where a.roles contains ? 这样的查询 解决方案:HQL不提供contains的查询,但可以利用join,解决方法是:select a from Account a join a.roles r where r.id = ? 心得:HQL 的join后面不一定非要跟一个实体,不能被SQL的思维定势套牢了!
比如说,现在有4个实体:Person,Teacher,Student,和Account,Teacher和Student继承自Person,Account与Person是单向的一对一关系。(这只是为了举例,请不要考虑诸如这样的实体设计是否合理的问题)如下所示: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING) public abstra ...
我的话: 这几天在做一个小项目,我负责先实现底层的DAO与Service,用的是Spring+Hibernate,使用HibernateTemplate实现简单的增删改查功能。按理说应该很简单,但是我用JUnit测试的时候却发现很诡异的问题:1、save方法发出了sql,但数据库却没有相应记录;2、load方法获取不到对象,只有一个代理,调用任何属性就会说LazyInitialization 我们知道所谓的懒加载的原因是session被关闭了。在web环境下我们可以在web.xml里面加入OpenSessionInView的过滤器,那在junit下应该怎么办呢? 最后在网上找到了一篇文章, ...
Fanny的话:今天总算用了一次CSS Hack,以前的前辈们真的太强悍了~~~~记录一下,以后再备用。 ================================================================================== 原文地址:http://www.div-css.com/html/XHTML-CSS/hack/1136667.html     区别IE6与FF:        background:orange;*background:blue;   区别IE6与IE7:        background:gr ...
作者:anxinwang原文链接:http://sophieplussoftware.blogbus.com/logs/30326776.html AJAX是web20的基石,现在网上流行几种开源的AJAX框架,比如:jQuery,Mootools,Dojo,Ext JS等等,那么我们到底在什么情况下该使用那个框架?以下是一组摘抄的数据: Ajaxian在2007年底对Ajax工具进行了调查,部分调查结果见下表(其中数字为调查者使用该工具的百分比,详细的请参见网页):http://ajaxian.com/archives/2007-ajax-tools-usage-survey-resu ...
IE'S MOMENTARY LAPSE OF REASON: The reason this occurs is because when you set the width of the iframe, the body of the included page inherits that width. So if the iframe has its width set to 400px, the body of the included page has its width set to 400px. This is not a problem unless the height of ...
Global site tag (gtag.js) - Google Analytics