This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

virtual persistent field question  RSS feed

 
Zul Chewanabas
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!