一个nested exception问题

一个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页面中

2,226人评论了“一个nested exception问题”

  1. I needed to compose you one very small word to help thank you very much as before just for the precious things you have discussed in this case. It was really unbelievably open-handed of you to make without restraint all that some people might have sold as an ebook to help with making some dough on their own, precisely given that you could possibly have done it if you ever wanted. These ideas in addition served as a easy way to be aware that other individuals have similar keenness much like mine to find out very much more concerning this matter. I’m sure there are lots of more enjoyable situations up front for folks who start reading your site.

  2. I have to show appreciation to you for bailing me out of such a difficulty. As a result of looking throughout the world wide web and getting thoughts which are not productive, I figured my entire life was gone. Living devoid of the answers to the problems you’ve sorted out through the website is a crucial case, and the ones which may have negatively affected my career if I had not noticed the blog. Your good mastery and kindness in taking care of almost everything was precious. I don’t know what I would have done if I hadn’t encountered such a point like this. I am able to at this time relish my future. Thanks very much for this impressive and amazing help. I will not hesitate to recommend the blog to anyone who needs and wants tips about this problem.

  3. I’m just commenting to let you understand what a amazing experience my friend’s daughter had going through your web page. She discovered so many details, most notably how it is like to possess an awesome coaching character to make other individuals completely know a variety of tortuous topics. You truly surpassed our own expectations. Many thanks for showing the beneficial, healthy, revealing and even fun guidance on your topic to Ethel.

  4. My husband and i felt so glad when John could finish off his investigations through the precious recommendations he grabbed when using the site. It’s not at all simplistic to simply be handing out guidance other people might have been making money from. And we all realize we’ve got the blog owner to appreciate for this. The type of illustrations you made, the easy web site menu, the relationships you can give support to create – it is everything extraordinary, and it’s assisting our son and us consider that the issue is awesome, which is certainly rather indispensable. Many thanks for all the pieces!

  5. you are really a just right webmaster. The site loading velocity is incredible.
    It kind of feels that you are doing any unique trick.
    Moreover, The contents are masterpiece. you’ve done a great task in this topic!

  6. I needed to post you a little bit of remark to help say thanks as before considering the marvelous information you have documented on this website. This has been certainly pretty open-handed with people like you to grant unhampered what a few individuals could possibly have marketed as an ebook to help with making some cash on their own, even more so seeing that you might have tried it in case you desired. Those tricks additionally served to be a great way to be aware that other people have the identical passion just like mine to know very much more when considering this matter. I’m certain there are many more fun sessions up front for individuals who read through your website.

  7. I wish to show thanks to this writer just for rescuing me from this scenario. Right after researching through the the web and obtaining thoughts that were not pleasant, I assumed my entire life was well over. Living without the presence of solutions to the problems you have resolved through your entire article is a critical case, as well as the ones which may have negatively damaged my entire career if I hadn’t come across the blog. The mastery and kindness in taking care of everything was excellent. I don’t know what I would have done if I had not encountered such a subject like this. I can at this time relish my future. Thanks for your time so much for this skilled and result oriented help. I will not think twice to refer the website to anybody who would need guidance on this area.

  8. I precisely desired to say thanks once again. I do not know what I might have achieved without the type of advice shared by you about such question. Completely was a very horrifying condition in my circumstances, nevertheless encountering a new specialised avenue you handled that forced me to weep with delight. I’m just thankful for this assistance and thus hope you really know what a powerful job that you’re undertaking training the rest through the use of your site. Probably you have never met all of us.

  9. Needed to compose you this very small observation so as to thank you very much over again about the spectacular pointers you have discussed above. This has been so incredibly open-handed of you giving without restraint what exactly many people could possibly have supplied for an e-book to help make some profit for their own end, precisely since you could possibly have done it in case you desired. The principles additionally acted like a great way to comprehend other people have the same interest like mine to know a little more with regard to this condition. I know there are many more pleasurable times in the future for those who view your blog post.

  10. Thanks a lot for providing individuals with remarkably memorable opportunity to read from this web site. It’s always very great and packed with a great time for me personally and my office mates to search your web site the equivalent of three times a week to study the fresh things you have. And of course, I am also actually amazed with your fantastic advice you give. Selected 2 points in this article are unquestionably the finest we have all ever had.

  11. Thanks a lot for giving everyone such a pleasant opportunity to read from here. It really is so awesome and also jam-packed with a great time for me personally and my office acquaintances to visit your website the equivalent of 3 times in a week to read through the latest secrets you have got. And definitely, we’re always amazed considering the sensational concepts served by you. Certain 2 areas in this article are ultimately the most beneficial I’ve had.

  12. I wish to get across my love for your kind-heartedness in support of folks that need assistance with this one idea. Your real dedication to getting the solution around turned out to be incredibly informative and have continually encouraged most people just like me to realize their desired goals. This valuable information means this much to me and somewhat more to my peers. Thanks a ton; from everyone of us.

  13. I’m just commenting to let you understand what a great encounter my cousin’s girl obtained going through your blog. She noticed some issues, with the inclusion of what it’s like to have a wonderful coaching mood to have folks easily master a variety of complicated subject matter. You actually did more than our desires. Thank you for producing such valuable, dependable, edifying and cool tips on the topic to Kate.

  14. I in addition to my buddies were actually going through the great solutions found on your website and before long got a horrible suspicion I never expressed respect to you for those strategies. My women were definitely so passionate to read them and now have in reality been having fun with those things. Thank you for really being considerably helpful and then for having this sort of ideal information millions of individuals are really desperate to know about. My very own sincere regret for not saying thanks to sooner.

  15. Thanks a lot for providing individuals with remarkably remarkable possiblity to read critical reviews from here. It can be very brilliant and packed with a great time for me personally and my office co-workers to search your site at the least three times in 7 days to find out the newest stuff you have. Of course, we’re always contented with all the staggering opinions you give. Certain 2 ideas in this posting are indeed the most effective we have all ever had.

  16. My wife and i were quite comfortable when Emmanuel could do his homework through the entire precious recommendations he obtained while using the web pages. It is now and again perplexing to simply be freely giving secrets which often many others could have been trying to sell. So we grasp we have got the blog owner to thank for that. The specific explanations you have made, the easy blog navigation, the friendships you will give support to engender – it’s got most remarkable, and it’s really aiding our son in addition to us do think the situation is entertaining, and that’s incredibly important. Thanks for everything!

  17. I would like to express my thanks to you for rescuing me from this particular scenario. Just after surfing throughout the the net and coming across basics that were not pleasant, I figured my life was done. Existing minus the answers to the difficulties you have sorted out all through your entire short article is a serious case, and the kind that might have in a negative way damaged my career if I hadn’t noticed your blog. Your own personal natural talent and kindness in dealing with the whole lot was helpful. I’m not sure what I would have done if I had not encountered such a point like this. It’s possible to at this point look ahead to my future. Thanks a lot very much for your professional and sensible help. I will not be reluctant to endorse your blog to anybody who should receive guidance on this subject matter.

发表评论

电子邮件地址不会被公开。 必填项已用*标注