JSF支持bean和hibernate实体相同的类? [英] JSF backing bean and hibernate entity same class?

查看:93
本文介绍了JSF支持bean和hibernate实体相同的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以为JSF支持bean和hibernate实体使用同一个类吗?我认为我可以,但是当我对backing bean进行一些JSF验证时,字段没有设置(即null)。



有什么我错过了使这两种技术在一起很好地发挥作用?或者,它是不是同时使用相同的类的做法?



感谢您的帮助。

Joe

解决方案

技术上我不确定,但逻辑上没有多大意义。当您的JSF支持bean与用户会话关联时,您将休眠bean关联到数据库记录。我认为尝试在同一个班级中混用这两种材料只会造成混乱。


Can I use the same class for a JSF backing bean and a hibernate entity? I assumed that I could but when I do some JSF validation on the backing bean, the fields are not set (i.e. null).

Is there something I'm missing to make these two technologies play nicely together? Or is it simply not the practice to use the same class for both?

Thanks for any help.

Joe

解决方案

I'm not sure technically but it doesn't make much sense logically. You're hibernate beans are associated to database records while your JSF backing beans are associated to user sessions. I think trying mix the two in the same class will cause nothing but confusion.

这篇关于JSF支持bean和hibernate实体相同的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆