一个hibernate报的异常:nested exception is org.hibernate.QueryException: could not resolve property困扰了我好一阵。
原来是因为hibernate对象不能多层嵌套查询,比如:
dc.add(Restrictions.eq(“wdxcAddressbookClass.wdxcUser.id”,ownerId));
改为:
dc.add(Restrictions.sqlRestriction(“{alias}.classid in (select id from wdxc_addressbook_class where ownerid=?)”,ownerId,Hibernate.LONG));
之后就可以了
顺便把前几天遇到的一个问题也记录一下:
环境是jsf+spring+hibernate,由于页面还没设计好,后台业务处理部分已经写好了,想测试一下,就做了一个测试jsp页面
异常信息:could not initialize proxy – the owning Session was closed
解决方法一:
[java]
public WdxcAddressbook getAddressbookByID(Serializable id) {
WdxcAddressbook addressbook =(WdxcAddressbook)dao.load(WdxcAddressbook.class,id);
//System.out.println(addressbook.getId());
return addressbook;
}
[/java]
在spring接口实现类中获取一下对象,就是上面注释掉的
解决方面二:
在web.xml中把.jsp页面也添加到hibernate的filter-mapping
原因:原来jsf的hibernate filter处理的都是.faces的页面,没有处理.jsp的页面,而且hibernate数据库实际获取操作是在用户实际获取值的时候发生的,所以需要filter把session延迟到jsp页面中
Because the admin of this web site is working, no question very quickly it will be renowned, due to its quality contents.|
Thanks for finally talking about > blog_title < Loved it!|
Excellent way of explaining, and good piece of writing to obtain facts regarding my presentation subject, which i am going to deliver in school.|
We are a group of volunteers and opening a brand new scheme in our community. Your website provided us with useful info to work on. You have done an impressive activity and our whole neighborhood will probably be thankful to you.|
Thanks for your personal marvelous posting! I genuinely enjoyed reading it, you can be a great author.I will make certain to bookmark your blog and will come back later on. I want to encourage you to definitely continue your great posts, have a nice morning!|
Fantastic goods from you, man. I’ve understand your stuff previous to and you are just too wonderful. I really like what you have acquired here, certainly like what you are stating and the way in which you say it. You make it enjoyable and you still take care of to keep it wise. I can not wait to read far more from you. This is really a wonderful web site.|
Appreciate the recommendation. Will try it out.|
hi!,I love your writing so a lot! share we communicate more approximately your post on AOL? I require an expert on this area to unravel my problem. Maybe that’s you! Taking a look ahead to peer you. |
May I simply say what a comfort to discover somebody who really knows what they’re talking about online. You certainly understand how to bring an issue to light and make it important. A lot more people ought to read this and understand this side of the story. I was surprised you’re not more popular because you definitely have the gift.|
Thank you so much for giving everyone remarkably pleasant chance to discover important secrets from this site. It is often so useful and as well , full of a good time for me and my office acquaintances to search your blog minimum three times a week to read through the new stuff you have got. Of course, I’m also usually fulfilled concerning the outstanding thoughts served by you. Selected 2 ideas in this article are in fact the most suitable we have had.
I in addition to my guys happened to be checking out the good solutions from your web page then the sudden came up with a terrible feeling I had not expressed respect to the site owner for those tips. Those young men are actually consequently stimulated to see all of them and have in effect surely been tapping into them. We appreciate you indeed being very considerate as well as for pick out such cool guides most people are really wanting to understand about. My very own honest apologies for not saying thanks to you earlier.
I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme? Superb work!|
Wow, this article is good, my younger sister is analyzing these kinds of things, thus I am going to let know her.|
Nice weblog here! Additionally your website lots up fast! What host are you the usage of? Can I get your affiliate link to your host? I want my web site loaded up as fast as yours lol|
My brother recommended I might like this website. He used to be entirely right. This submit truly made my day. You cann’t believe just how a lot time I had spent for this info! Thanks!|
royal thank.
I’m extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it’s rare to see a nice blog like this one nowadays.|
Hello, I want to subscribe for this weblog to obtain latest updates, so where can i do it please assist.|
Hi there, everything is going nicely here and ofcourse every one is sharing information, that’s really fine, keep up writing.|
Write more, thats all I have to say. Literally, it seems as though you relied
on the video to make your point. You definitely know
what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?
I’m really enjoying the design and layout of your website. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Fantastic work!|
Wow that was odd. I just wrote an extremely long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say wonderful blog!|
Hello it’s me, I am also visiting this site on a regular basis, this website is actually fastidious and the viewers are really sharing pleasant thoughts.|