Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disconnected POJOs?

 
Sean Davis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I came across this term on the web, so I don't understand what the heck it means? I know how to write a simple hibernate/spring mvc web-app with some mapped POJOs, but I am curious if you guys heard of the term?

If they (ie. disconnected POJOs) are different then the POJO's (self-contained java objects that know nothing about the web) that I know of, what exactly are their advantages? Ok, maybe i am confused.

Umm, is there also a "connected" POJO?

Thanks,
Sean D.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate uses the term detached. Like in 10.1. Hibernate object states.

Detached POJOs survive past the hibernate session that created them. Usually they are used so that transfer objects are no longer necessary. When a subsequent session tries to re-attach the detached instances it has to first query the DB to determine the current state that is stored in the DB and then take the appropriate actions before re-attaching the instance back into the current session (and updating/synchronizing the DB).
 
Sean Davis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peer,

Thank you for the response. So, the only advantage I am seeing with that is, it allows you to export your POJO's to clients, who can then make changes to them locally and then export them back at a later time to the persistent tier which can then re-attach a sesssion to the pojo and persist it. Is that pretty much the only advantage? Thanks.

/Sean
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sean Davis:
Is that pretty much the only advantage?

Well, yes, but maybe you do not appreciate the full extent of the advantage. For one you don't have to code separate transfer objects (unless the POJO isn't serializable for some reason � some people don't like to make their objects serializable but that's another discussion entirely). Also Hibernates gives you the option of doing a select-before-update to minimize unnecessary updates (at the cost of additional selects). Also managed versioning will help you implement an Optimistic Offline Lock without much fuss. Overall there are a lot of features here that can come together to save you a lot of coding.
 
Sean Davis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wonderful,

Sounds like I'll need to take a little more look into the peformance/security enhancements that hibernate can bring to the tiers. Thanks a lot Peer. Let the journey begin!

/Sean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic