持久对象在Hibernate体系结构中意味着什么? [英] What does persistence object means in Hibernate architecture?

查看:98
本文介绍了持久对象在Hibernate体系结构中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hibernate是一个持久性框架,用于持久化数据 从Java环境到数据库.

Hibernate is a persistence framework which is used to persist data from Java environment to database.

我很困惑..如果我们将对象持久化到数据库,那么为什么Hibernate Architecture在下图中将Application和Hibernate的中间对象描述为持久性对象?

I am so confused.. if we persist an object to the database, then why does Hibernate Architecture depicts the persistent object in the middle of Application and Hibernate in the picture below?


(来源: viralpatel.net )


(source: viralpatel.net)

推荐答案

我将使其更加清晰.持久对象是您创建的POJO类的实例,这些实例表示数据库表中的行. 根据 hibernate-doc ,POJO实例表示数据库中表的类会经历3种状态,其中持久状态是其中之一.

I will make it more clearer. Persistent objects are instances of POJO classes that you create that represent rows in the table in the database. According to hibernate-doc an instance of POJO class representing table in database goes through 3 states of which persistent is one of them.

当POJO实例处于会话范围内时,它被认为是持久的,即,当我们关闭或刷新会话时,hibernate会检测到对该对象所做的任何更改并将其与数据库同步.

When a POJO instance is in session scope, it is said to be persistent i.e hibernate detects any changes made to that object and synchronizes it with database when we close or flush the session.

关于hibernate.properties和XML映射,@ Ken Chan是正确的.浏览 hibernate-doc 以获得更多插图对象处于休眠状态.

And about hibernate.properties and XML Mapping @Ken Chan is right. Go through hibernate-doc for more illustrations on objects in hibernate.

这篇关于持久对象在Hibernate体系结构中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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