• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

how pojo is different from Normal Java Beans ?

 
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

What makes the Spring POJO Object different from the normal Java Beans Object.'


Regards,
Prabhat
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing.
 
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
POJO == plain old Java object

In other words, one without special semantics like an Enterprise bean or servlet.

So "normal" JavaBeans are a good example of a POJO.
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In practice, there's no difference.
In theory, JavaBeans follow the JavaBean conventions. POJOs have no such requirement.

However, since you mentioned Spring POJOs (no such thing, by the way: POJOs are by definition not related to any specific API or framework), Spring makes use of the JavaBean conventions for accessor methods in the IOC container). So spring-managed POJOs should follow the JavaBean convention in order to be properly configurable via Spring.
 
Ranch Hand
Posts: 85
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaBean have to follow the JavaBean spec to be called java beans, POJO's there is no such req, pojos are plain old java objects
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

As i know Hibernate Persists both Java Beans/POJO.

While Java Beans have few Restrictions:

1) NO Argument Constructor
2) Must Implements java.io.Serilizable Interface
3) It should not extend any special Base Class
4) It should contain the getter and Setter Methods for instance variables with Naming Convention.

However these rules doesn't affect Hibernate Persistnce Ability to Java Beans.

While Hibernate Persists those POJO Which must have a default Constructor.

Hibernate does not require the POJOs or JavaBeans to implement any special interface or extend any special
sub-class. This is one of the features that distinguish Hibernate from some of the other persistent frameworks.
In fact, Hibernate does not even require persistent classes to implement Serializable as the JavaBean spec
requires.

Persistent classes do not need to import or use any Hibernate packages.

 
reply
    Bookmark Topic Watch Topic
  • New Topic