Pojo là gì

I”m not sure about the difference. I”m using Hibernate and, in some books, they use JavaBean và POJO as an interchangeable term. I want khổng lồ know if there is a difference, not just in the Hibernate context, but as general concepts.

Bạn đang xem: Pojo là gì

Đang xem: Pojo là gì

*
*
*
*

nagapavannagapavan 1,07111 gold badge77 silver badges22 bronze badges 3 Add a phản hồi | 25According khổng lồ Martin Fowler a POJO is an object which encapsulates Business Logic while a Bean (except for the definition already stated in other answers) is little more than a container for holding data and the operations available on the object merely set & get data.

The term was coined while Rebecca Parsons, Josh MacKenzie and I were preparing for a talk at a conference in September 2000. In the talk we were pointing out the many benefits of encoding business xúc tích và ngắn gọn inkhổng lồ regular java objects rather than using Entity Beans. We wondered why people were so against using regular objects in their systems và concluded that it was because simple objects lacked a fancy name. So we gave them one, & it”s caught on very nicely.

http://www.martinfowler.com/bliki/POJO.html

Share Improve sầu this answer Follow answered Oct 12 “15 at 7:23 SphygmomanometerSphygmomanometer 56555 silver badges1010 bronze badges Add a phản hồi | 9Pojo – Plain old java object

pojo class is an ordinary class without any specialties,class totally loosely coupled from technology/framework.the class does not implements from technology/framework and does not extends from technology/framework api that class is called pojo class.

pojo class can implements interfaces and extover classes but the super class or interface should not be an technology/framework.

Examples :

1.

class ABC—-ABC class not implementing or extending from technology/framework that”s why this is pojo class.

2.

class ABC extends HttpServlet—ABC class extending from servlet technology api that”s why this is not a pojo class.

3.

Xem thêm: Xem Phim Lời Nguyền Những Vì Sao Tập 12, Hóa Giải Lời Nguyền

class ABC implements java.rngươi.Remote—-ABC class implements from rngươi api that”s why this is not a pojo class.

4.

class ABC implements java.io.Serializable—this interface is part of java language not a part of technology/framework.so this is pojo class.

5.

class ABC extends Thread–here thread is also class of java language so this is also a pojo class.

6.

class ABC extends Test–if Test class extends or implements from technologies/framework then ABC is also not a pojo class because it inherits the properties of Test class.if Test class is not a pojo class then ABC class also not a pojo class.

7.

now this point is an exceptional case

Entityclass ABC–Entity is an annotation given by hibernate api or jpage authority api but still we can hotline this class as pojo class.class with annotations given from technology/framework is called pojo class by this exceptional case.

Xem thêm: Video Hướng Dẫn Sử Dụng Vbhxh Viettel, Hướng Dẫn Sử Dụng Vbhxh Viettel


Trả lời Hủy

Thư điện tử của bạn sẽ không được hiển thị công khai. Các trường buộc phải được ghi lại *

Bình luận

Tên *

Thư điện tử *

Trang web

Lưu thương hiệu của tôi, email, với website vào trình chuyên chú này mang lại lần comment sau đó của tôi.


Chuyên mục: Kiến Thức