本文介绍了JavaBean和POJO有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定区别。我正在使用Hibernate,在某些书中,他们使用JavaBean和POJO作为可互换的术语。我想知道是否存在差异,不仅仅是在Hibernate上下文中,而是作为一般概念。

I'm not sure about the difference. I'm using Hibernate and, in some books, they use JavaBean and POJO as an interchangeable term. I want to know if there is a difference, not just in the Hibernate context, but as general concepts.

推荐答案

遵循JavaBean某些惯例。 Getter / setter命名,具有公共默认构造函数,可序列化等。请参阅以获取更多详细信息。

A JavaBean follows certain conventions. Getter/setter naming, having a public default constructor, being serialisable etc. See JavaBeans Conventions for more details.

未严格定义POJO(普通旧Java对象)。它是一个Java对象,它不需要实现特定的接口或从特定的基类派生,或者使用特定的注释以便与给定的框架兼容,并且可以是任意的(通常相对简单) Java对象。

A POJO (plain-old-Java-object) isn't rigorously defined. It's a Java object that doesn't have a requirement to implement a particular interface or derive from a particular base class, or make use of particular annotations in order to be compatible with a given framework, and can be any arbitrary (often relatively simple) Java object.

这篇关于JavaBean和POJO有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 00:38