hibernate教程

Recently I have written a lot of hibernate tutorial. Hibernate is one of the best Java ORM tool in the current market. So this post is like an index of all the posts for hibernate tutorials and examples. You can go through these hibernate tutorials in sequence to learn hibernate from scratch. Most probably I will be adding more hibernate tutorials to the list, so you might want to bookmark it and check it once in a while.

最近我写了很多Hibernate教程。 Hibernate是当前市场上最好的Java ORM工具之一。 因此,这篇文章就像是所有有关Hibernate教程和示例的文章的索引。 您可以依次阅读这些Hibernate教程,以从头开始学习Hibernate。 很可能我将在列表中添加更多的Hibernate教程,因此您可能希望将其添加为书签并不时检查一下。

Hibernate教程 (Hibernate Tutorial)

  1. Hibernate Tutorial for Beginners

    Hibernate supports JPA annotations and it’s very flexible. We can configure it using XML, property files as well as programmatically. This tutorial is a great way to get you started with hibernate framework. This tutorial focuses on different configurations required for hibernate and provide examples of simple XML based mapping as well as JPA annotations based mapping. You will also learn different ways to initialize SessionFactory and important components of the hibernate framework.

    初学者Hibernate指南

    Hibernate支持JPA注释,它非常灵活。 我们可以使用XML,属性文件以及以编程方式配置它。 本教程是帮助您入门Hibernate框架的好方法。 本教程重点介绍Hibernate所需的不同配置,并提供基于简单XML映射以及基于JPA批注的映射的示例。 您还将学习初始化SessionFactory和Hibernate框架的重要组件的不同方法。

  2. Hibernate One-to-One Mapping

    Most of the times, database tables are associated with each other. There are many forms of association – one-to-one, one-to-many and many-to-many are at the broad level, that can be further divided into unidirectional and bidirectional mappings. This tutorial guides you through implementing Hibernate One to One Mapping using XML configuration as well as using JPA annotations configuration.

    Hibernate一对一映射

    大多数情况下,数据库表是相互关联的。 关联的形式多种多样-一对一,一对多和多对多在广义上,可以进一步分为单向映射和双向映射。 本教程将指导您使用XML配置以及JPA批注配置来实现Hibernate一对一映射。

  3. Hibernate One-to-Many Mapping

    In simple terms, one to many mapping means that one row in a table can be mapped to multiple rows in another table. For example, think of a Cart system where we have another table for Items. A cart can have multiple items, so here we have one to many mapping. In this tutorial you will learn how to implement One to Many Mapping using XML based configuration and then using Hibernate Annotations.

    Hibernate一对多映射

    简单来说,一对多映射意味着表中的一行可以映射到另一表中的多行。 例如,考虑一个Cart系统,其中有另一个Items表。 一个购物车可以有多个商品,因此这里有一对多映射。 在本教程中,您将学习如何使用基于XML的配置然后使用Hibernate Annotations实现一对多映射。

  4. Hibernate Many-to-Many Mapping

    Many-to-Many mapping is usually implemented in database using a Join Table, for example we can have Cart and Item table and Cart_Items table for many-to-many mapping. Every cart can have multiple items and every item can be part of multiple carts, so we have a many to many mapping here. This tutorial explains about hibernate many-to-many unidirectional as well as bidirectional mapping.

    Hibernate多对多映射

    多对多映射通常是使用联接表在数据库中实现的,例如,对于多对多映射,我们可以具有Cart和Item表以及Cart_Items表。 每个购物车可以有多个商品,每个商品可以是多个购物车的一部分,因此我们在这里有多对多映射。 本教程介绍了Hibernate的多对多单向和双向映射。

  5. Hibernate Query Language (HQL)

    Hibernate Framework comes with a powerful object-oriented query language – Hibernate Query Language (HQL). It’s very similar to SQL except that we use Objects instead of table names, that makes it more close to object oriented programming. This article explains about HQL and different clauses supported by HQL language.

    Hibernate查询语言(HQL)

    Hibernate Framework随附了功能强大的面向对象的查询语言-Hibernate Query Language(HQL)。 它与SQL非常相似,不同之处在于我们使用对象而不是表名,这使其更接近于面向对象的编程。 本文介绍了有关HQL和HQL语言支持的不同子句。

  6. Hibernate Native SQL Query

    Hibernate provide option to execute native SQL queries through the use of SQLQuery object. This is very handy when we want to execute database specific queries that are not supported by Hibernate API such as query hints or the CONNECT keyword in Oracle Database.

    Hibernate本机SQL查询

    Hibernate提供了通过使用SQLQuery对象执行本机SQL查询的选项。 当我们要执行Hibernate API不支持的特定于数据库的查询(例如查询提示或Oracle数据库中的CONNECT关键字)时,这非常方便。

  7. Hibernate Named Query

    If there are a lot of HQL or Native SQL Queries, then they will cause a code mess because all the queries will be scattered throughout the project. That’s why Hibernate provides Named Query that we can define at a central location and use them anywhere in the code. We can created named queries for both HQL and Native SQL.

    Hibernate Named Queries can be defined in Hibernate mapping files using query or sql-query element or through the use of JPA annotations @NamedQuery and @NamedNativeQuery.

    Hibernate命名查询

    如果有很多HQL或本机SQL查询,则它们将导致代码混乱,因为所有查询都将分散在整个项目中。 这就是为什么Hibernate提供命名查询的原因,我们可以在中央位置进行定义并在代码中的任何位置使用它们。 我们可以为HQL和本机SQL创建命名查询。

    可以使用querysql-query元素或通过使用JPA批注@NamedQuery和@NamedNativeQuery在Hibernate映射文件中定义Hibernate命名查询。

  8. Hibernate Criteria

    Hibernate provides Criteria API that is more object oriented for querying the database and getting results. We can’t use Criteria to run update or delete queries or any DDL statements. It’s only used to fetch the results from the database using more object oriented approach.

    Some of the common usage of Criteria API are Projection that we can use for aggregate functions such as sum(), min(), max() etc, ProjectionList to fetch selected columns only, ordering the results etc.

    Hibernate标准

    Hibernate提供的Criteria API更面向对象,用于查询数据库和获取结果。 我们无法使用条件来运行更新或删除查询或任何DDL语句。 它仅用于使用更多面向对象的方法从数据库中获取结果。

    Criteria API的一些常见用法是Projection,我们可以将其用于聚合函数,例如sum(),min(),max()等,ProjectionList仅用于获取选定的列,对结果进行排序等。

  9. Hibernate First Level Cache

    Hibernate Cache can be very useful in gaining fast application performance if used correctly. The idea behind cache is to reduce the number of database queries, hence reducing the throughput time of the application.
    Hibernate first level cache is associated with the Session object. Hibernate first level cache is enabled by default and there is no way to disable it. However hibernate provides methods through which we can delete selected objects from the cache or clear the cache completely. Any object cached in a session will not be visible to other sessions and when the session is closed, all the cached objects will also be lost.

    Hibernate一级缓存

    如果正确使用Hibernate Cache,在获得快速应用程序性能方面将非常有用。 缓存背后的想法是减少数据库查询的数量,从而减少应用程序的吞吐时间。
    Hibernate一级缓存与会话对象相关联。 默认情况下,Hibernate一级缓存处于启用状态,无法禁用它。 但是,hibernate提供了一些方法,通过这些方法,我们可以从缓存中删除选定的对象或完全清除缓存。 会话中缓存的任何对象对其他会话都不可见,并且在关闭会话时,所有缓存的对象也将丢失。

  10. Hibernate Second Level Cache with EHCache

    Hibernate Second Level cache providers include EHCache and Infinispan, but EHCache is more popular because it’s easy to integrate and supports all the hibernate caching strategies. This tutorial provides a complete example to integrate EHCache with Hibernate framework.

    带有EHCache的Hibernate二级缓存

    Hibernate Second Level缓存提供程序包括EHCache和Infinispan,但是EHCache更为流行,因为它易于集成并支持所有Hibernate缓存策略。 本教程提供了一个将EHCache与Hibernate框架集成的完整示例。

  11. Hibernate get vs load

    Hibernate Session provide different methods to fetch data from database. Two of them are – get() and load(). There are also a lot of overloaded methods for these, that we can use in different circumstances.

    At first look both get() and load() seems similar because both of them fetch the data from database. However there are few differences between them, this tutorial explains about them with example code.

    Hibernate获取与负载

    Hibernate Session提供了从数据库中获取数据的不同方法。 其中两个是– get()和load()。 这些方法还有很多重载方法,我们可以在不同的情况下使用。

    乍一看,get()和load()看起来都很相似,因为它们都从数据库中获取数据。 但是它们之间几乎没有区别,本教程通过示例代码对它们进行了解释。

  12. Hibernate save vs persist

    Hibernate Session is the interface between java application and hibernate framework. This tutorial explains about Session important methods for saving and updating data in tables – save, saveOrUpdate, persist, update and merge.

    Hibernate保存与持久化

    Hibernate Session是Java应用程序和hibernate框架之间的接口。 本教程介绍了会话中用于保存和更新表中数据的重要方法-保存,保存或更新,持久保存,更新和合并。

  13. Hibernate openSession vs getCurrentSession

    Hibernate SessionFactory is the factory class through which we get sessions and perform database operations. Hibernate SessionFactory provides three methods through which we can get Session object – getCurrentSession(), openSession() and openStatelessSession(). This tutorial explains about each one of them with example code.

    HibernateopenSession与getCurrentSession

    Hibernate SessionFactory是工厂类,通过它我们可以获取会话并执行数据库操作。 Hibernate SessionFactory提供了三种获取Session对象的方法-getCurrentSession(),openSession()和openStatelessSession()。 本教程使用示例代码解释了其中的每一个。

  14. Hibernate log4j integration

    Hibernate 4 uses JBoss logging but log4j is the most popular logging framework. A quick tutorial explaining how to integrate log4j logging with hibernate framework.

    Hibernate log4j集成

    Hibernate 4使用JBoss日志记录,但是log4j是最受欢迎的日志记录框架。 快速教程,介绍如何将log4j日志记录与hibernate框架集成。

  15. Hibernate Tomcat JNDI DataSource Example

    Most of the times hibernate framework is used in web applications running in Tomcat or any other servlet container. Hibernate can use the DataSource defined as JNDI resource in the container, this is the preferred approach to let servlet container handle the database connections using connection pooling.

    Hibernate Tomcat JNDI数据源示例

    大多数情况下,Hibernate框架用于在Tomcat或任何其他servlet容器中运行的Web应用程序中。 Hibernate可以在容器中使用定义为JNDI资源的DataSource,这是让servlet容器使用连接池处理数据库连接的首选方法。

  16. Spring Hibernate Integration

    Spring is one of the most used Java EE Framework and Hibernate is the most popular ORM framework. That’s why Spring Hibernate combination is used a lot in enterprise applications. This tutorial uses Spring 4 and integrate it with Hibernate 3 and then update the same project to use Hibernate 4.

    Spring Hibernate集成

    Spring是最常用的Java EE框架之一,而Hibernate是最流行的ORM框架。 这就是为什么Spring Hibernate组合在企业应用程序中大量使用的原因。 本教程使用Spring 4并将其与Hibernate 3集成,然后将同一项目更新为使用Hibernate 4。

  17. Spring MVC Hibernate Example

    This tutorial moves forward and explains how to integrate Hibernate with Spring MVC and use Spring declarative transaction management, rather than using hibernate transaction management.

    Spring MVCHibernate示例

    本教程前进并说明如何将Hibernate与Spring MVC集成并使用Spring声明式事务管理,而不是使用hibernate事务管理。

  18. Struts2 Hibernate Integration Example

    This tutorial explains the general way to integrate Hibernate with any web application through the use of ServletContextLister, the example is using Struts2 with Hibernate but behind the scene integration is done using only Servlet technology. This is different from Spring integration because Struts2 doesn’t provide any built-in support for hibernate integration.

    Struts2Hibernate集成示例

    本教程说明了通过使用ServletContextLister来将Hibernate与任何Web应用程序集成的一般方法,示例是将Struts2与Hibernate一起使用,但在后台进行集成时仅使用Servlet技术。 这与Spring集成不同,因为Struts2不为Hibernate集成提供任何内置支持。

  19. Hibernate Validator Example

    Data validation is an integral part of any application. It’s a cross cutting task that happens at presentation layer, business layer as well as persistent layer. That’s why JSR-303 provides annotation based standard for applying validation for java bean properties. Hibernate Validator provides support for JSR-303 and this tutorial shows it’s usage with a simple example.

    Hibernate验证器示例

    数据验证是任何应用程序不可或缺的一部分。 这是一个跨领域的任务,它发生在表示层,业务层以及持久层。 这就是JSR-303提供基于注释的标准以对Java bean属性应用验证的原因。 Hibernate Validator提供了对JSR-303的支持,本教程通过一个简单的示例说明了它的用法。

  20. Hibernate Tools Eclipse Plugin

    If you have worked on hibernate projects, you must be familiar with a lot of properties we need for hibernate mapping and configuration file. Without any proper tool that can guide us in looking for correct properties, it will become very hard to correctly configure our application. This is when Hibernate Tools Eclipse Plugin comes handy and a must have plugin for hibernate projects.

    Hibernate Tools Eclipse插件

    如果您从事过Hibernate项目,则必须熟悉Hibernate映射和配置文件所需的许多属性。 没有任何可以指导我们寻找正确属性的适当工具,正确配置我们的应用程序将变得非常困难。 这是Hibernate Tools Eclipse插件方便使用且必须具有用于hibernate项目的插件的时候。

  21. Hibernate Interview Questions

    Having a good knowledge of Hibernate framework is a plus point for Java based interviews, that’s why I wrote this post. It contains most of the important questions related to Hibernate framework with detailed answers. You should go through these before going for interview to brush up your knowledge.

    Hibernate面试问题

    熟悉Hibernate框架是基于Java的采访的重点,这就是为什么我写这篇文章。 它包含与Hibernate框架相关的大多数重要问题,并提供详细的答案。 您应该在面试之前仔细阅读这些内容,以增强您的知识。

  22. Hibernate教程–常见错误修复 (Hibernate Tutorial – Common Error Fixes)

  23. How to configure hibernate.cfg.xml to work offline如何配置hibernate.cfg.xml以脱机工作
  24. org.hibernate.AnnotationException: No identifier specified for entity Classorg.hibernate.AnnotationException:未为实体类指定标识符
  25. org.hibernate.HibernateException: get is not valid without active transactionorg.hibernate.HibernateException:如果没有活动的交易,get无效
  26. org.hibernate.HibernateException: No CurrentSessionContext configuredorg.hibernate.HibernateException:未配置CurrentSessionContext
  27. Hibernate Program Not TerminatingHibernate程序未终止
  28. Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set未设置“ hibernate.dialect”时,对DialectResolutionInfo的访问不能为null

翻译自: https://www.journaldev.com/3793/hibernate-tutorial

hibernate教程

hibernate教程_Hibernate教程相关推荐

  1. hibernate示例_Hibernate条件示例教程

    hibernate示例 Welcome to the Hibernate Criteria Example Tutorial. Today we will look into Criteria in ...

  2. hibernate官方新手教程 (转载)

    hibernate官方新手教程第一部分 - 第一个Hibernate程序 首先我们将创建一个简单的控制台(console-based)Hibernate程序.我们使用内置数据库(in-memory d ...

  3. gwt-2.8.2下载_GWT 2 Spring 3 JPA 2 Hibernate 3.5教程– Eclipse和Maven 2展示

    gwt-2.8.2下载 不久前,我的一个朋友和同事向我飞过,说"世界上只有一半在使用Maven ". 当我意识到最受欢迎的文章(到目前为止) GWT 2 Spring 3 JPA ...

  4. gwt-2.8.2下载_GWT 2 Spring 3 JPA 2 Hibernate 3.5教程

    gwt-2.8.2下载 本分步指南将介绍如何使用以下方法开发简单的Web应用程序 Google的网络工具包 (GWT)用于富客户端,而Spring作为后端服务器端框架. 该示例Web应用程序将提供对数 ...

  5. Hibernate缓存级别教程

    开始使用Hibernate的人们常见的问题之一就是性能,如果您没有太多的Hibernate经验,您会发现应用程序变慢的速度. 如果启用sql跟踪,您将看到有多少查询被发送到数据库,而这些查询几乎不需要 ...

  6. GWT 2 Spring 3 JPA 2 Hibernate 3.5教程– Eclipse和Maven 2展示

    不久前,我的一个朋友和同事向我飞过,说"世界上只有一半在使用Maven ". 当我意识到最受欢迎的文章(到目前为止) GWT 2 Spring 3 JPA 2 Hibernate ...

  7. GWT 2 Spring 3 JPA 2 Hibernate 3.5教程

    本分步指南将介绍如何使用开发一个简单的Web应用程序 Google的网络工具包 (GWT)用于富客户端,而Spring作为后端服务器端框架. 该示例Web应用程序将提供对数据库执行CRUD(创建检索更 ...

  8. HQL - Hibernate查询语言 - 示例教程

    HQL - Hibernate查询语言 - 示例教程 HQL或Hibernate查询语言是Hibernate Framework的面向对象查询语言.HQL与SQL非常相似,只是我们使用Objects而 ...

  9. Hibernate Criteria示例教程

    Hibernate Criteria示例教程 欢迎使用Hibernate Criteria示例教程.今天我们将研究Hibernate中的Criteria. Hibernate Criteria 大多数 ...

最新文章

  1. 浅谈Dynamic 关键字系列之二:调用属性,方法,字段
  2. Chrome浏览器不支持字体小于12px的解决办法
  3. 19、修改和删除事件(ALTER/DROP EVENT)
  4. OpenCV拼接细节stitching detailed的实例(附完整代码)
  5. 17,18_常见函数梯度,激活函数梯度(Sigmoid、Tanh、ReLu)
  6. c语言的标准字符,C语言标准定义的32个关键字
  7. macos上的硬盘检测工具_如何在MacOS上使用双镜头面部检测器(DSFD)实现90%以上的精度
  8. python科学计算与图形渲染_宁哥Python科学计算与图形渲染库课程
  9. js 更改json的 key
  10. .NET面试题解析(04)-类型、方法与继承
  11. 机器学习笔记(十七)——EM算法的推导
  12. redis主从的配置和使用
  13. node稳定版本_Node.js十年,你大爷还是你大爷
  14. python连点封闭多边形_python实现根据给定坐标点生成多边形mask的例子
  15. github下载慢时可采用码云快速下载资源
  16. 关于 springboot 的自动配置
  17. mybatis使用详解
  18. 安装SQL 2008的错误 等待数据库引擎恢复句柄失败。请查看 SQL Server 错误日志以了解可能的原因
  19. 通用电源模块的测试方法及性能指标
  20. 环洋市场咨询:全球EMS和ODM收入预计2028年达到7978.5亿美元

热门文章

  1. 大数据商业智能的十大戒律
  2. 用 扩展事件抓取过去的死锁
  3. (转)windows身份验证登入数据库 iis 无法访问数据库
  4. [转载] python oct_Python oct()
  5. [转载] Python中filter筛选函数匿名参数问题
  6. [转载] python-pandas创建Series数据类型
  7. [转载] Java默认构造方法
  8. SDR与DDR的区别
  9. CMake 学习笔记 02 - 更复杂的项目
  10. 批处理脚本学习笔记——程序猿版