本文介绍了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 命名、具有公共默认构造函数、可序列化等.参见 JavaBeans约定了解更多详情.

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

POJO (plain-old-Java-object) 没有严格定义.它是一个 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 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 07:31