Hibernate.orgCommunity Documentation

前言

Working with object-oriented software and a relational database can be cumbersome and time consuming in today's enterprise environments. Hibernate is an Object/Relational Mapping tool for Java environments. The term Object/Relational Mapping (ORM) refers to the technique of mapping a data representation from an object model to a relational data model with a SQL-based schema.

Hibernate 不仅管理 Java 类到数据库表的映射(包括 Java 数据类型到 SQL 数据类型的映射),还提供数据查询和获取数据的方法,可以大幅度减少开发时对人工使用 SQL 和 JDBC 处理数据的时间。

Hibernate 的目标是对于开发者通常的数据持久化相关的编程任务,解放其中的 95%。对于以数据为中心的程序来说,它们往往只在数据库中使用存储过程来实现商业逻辑,Hibernate 可能不是最好的解决方案;对于那些在基于 Java 的中间层应用中,它们实现面向对象的业务模型和商业逻辑的应用,Hibernate 是最有用的。不管怎样,Hibernate 一定可以帮助你消除或者包装那些针对特定厂商的 SQL 代码,而且帮助你结果集从表格式的表示形式转换到一系列的对象中去。

如果你对 Hibernate 和对象/关系型数据库映射还是个新手,甚至对 Java 也不熟悉,请按照下面的步骤来学习。

  1. Read 第 1 章 教程 for a tutorial with step-by-step instructions. The source code for the tutorial is included in the distribution in the doc/reference/tutorial/ directory.

  2. Read 第 2 章 体系结构(Architecture) to understand the environments where Hibernate can be used.

  3. 查看 Hibernate 发行包中的 eg/ 目录,里面有个一简单的独立运行的程序。把你的 JDBC 驱动复制到 lib/ 目录并修改一下 etc/hibernate.properties,指定数据库的信息。然后进入命令行,切换到发行包的目录,输入 ant eg(使用 Ant),或者在 Windows 系统下使用 build eg

  4. Use this reference documentation as your primary source of information. Consider reading [JPwH] if you need more help with application design, or if you prefer a step-by-step tutorial. Also visit http://caveatemptor.hibernate.org and download the example application from [JPwH].

  5. 在 Hibernate 网站上可以找到问题和解答(FAQ)。

  6. Links to third party demos, examples, and tutorials are maintained on the Hibernate website.

  7. Hibernate 网站的社区是讨论关于设计模式以及很多整合方案(Tomcat、JBoss AS、Struts、EJB 等)的好地方。

如果你有任何问题,请使用 Hibernate 网站上链接的用户论坛。我们也提供一个 JIRA 问题追踪系统,来搜集 bug 报告和新的功能请求。如果对开发 Hibernate 有兴趣,请加入开发者的邮件列表。如果你对翻译本文档感兴趣,请通过开发者的邮件列表来联系我们。

商业开发、产品支持和 Hibernate 培训可以通过 JBoss Inc. 获得(请查阅: http://www.hibernate.org/SupportTraining/)。Hibernate 是一个专业的开源项目,也是 JBoss 企业级中间件系统(JBoss Enterprise Middleware System,JEMS)里的一个核心组件。