Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

virtual persistent field question

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed that for an entity bean class, it has to be declared abstract since we have to provide the virtual persistent field and map them to the column in the database. Then for encapsulation reason, we implement public getters and setters to return and set the values from outside the class.

Question:
If this is an abstract class, that means someone has to implement the concrete class since we have abstract methods, 'those virtual persistent fields', that need to be implemented. But according to the rule, we don 't have to implement those abstract getters/setters a.k.a. 'virtual persistent fields.' - we're supposed to leave them alone. This is really confusing.. can someone help me with this situation? thank you.
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zul,
When you generate the deployment code, the container implements the abstract class. It also generates ties, stubs and quite a few other classes.

Since you are never instantiating the bean directly as a programmer, you don't need to implement the abstract class.
 
Zul Chewanabas
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Jeanne. That makes a lot of sense now..so the container implements the abstract class at deployment time. thx
 
I am mighty! And this is a mighty small ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic