Java SE 6中的JPA / Hibernate,数据访问的最佳实践 [英] JPA/Hibernate in Java SE 6, Best Practices for data access

查看:103
本文介绍了Java SE 6中的JPA / Hibernate,数据访问的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始一个普通的Java SE项目,并计划使用JPA / Hibernate。我想知道是否有人能够启发我在这个环境(数据访问层)中与Hibernate进行交互的最佳方式是什么?

解决方案

我不确定什么被认为是最好的方法,但在我的工作场所,我们已经将这些文章中的大部分Hibernate交互作为基础:

< a href =http://www.onjava.com/pub/a/onjava/2006/09/13/dont-let-hibernate-steal-your-identity.html =noreferrer>不要让Hibernate窃取您的身份
通用数据访问对象



它们向您展示了如何以智能的方式创建映射类,以及如何实现可供任何持久化类重用的泛型DAO。这对我们来说很好。


I am starting a normal Java SE project and i am planning to use JPA/Hibernate. I was wondering if anyone could enlighten me as to what is considered the best way to interact with Hibernate in this environment (data access layers)?

解决方案

I'm not sure what's considered the best approach to this, but at my workplace, we have based most of our Hibernate interaction on these articles:

Don't let Hibernate steal your identity and Generic Data Access Objects

They show you how to make your mapped classes in a smart way, and how to implement a generic DAO that can be reused for any persistent class. This has worked out nicely for us.

这篇关于Java SE 6中的JPA / Hibernate,数据访问的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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