问题描述
我不确定区别。我正在使用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有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!