• Post Reply Bookmark Topic Watch Topic
  • New Topic

using get/set with entity beans

 
�yvind Valland
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, the wonders of learning... here I am, grappling with J2EE and EJBs, and my understanding is actually diminishing
My problem is as follows (well, one of them):
I have a an entity bean, which I will call Product. The Home interface of product has one method outside of the findByPrimaryKey method. findByCategory(String category) returns a collection of lovely products from my database.
So far, so good.
My sessionbean, called Business at this point, has a method on its remote interface which calls findByCategory on the Product home interface, takes the returned collection, turns it into a Vector, and returns this to the caller.
So far, still good.
Now, my little tester servlet instantiates a Business bean and calls the method to get the Vector of Product beans. This works fine. The problems are just around the corner.
A little more explaining is necessary. I am re-building an application that uses MVC architecture (JSP<->SERVLET<->JAVABEANS) as part of an assignment at uni. My MVC application has JSPs that loop through various vectors to print product and order information on the screen. I would very much like to keep my JSPs intact; hence the idea of returning a VECTOR of Product beans to the servlet (it will set the Vector in the session).
To test this, I tried to make the servlet loop through the vector while using a printWriter to display values returned by getter methods on the bean. But, alas! (and naturally), the servlet doesn't compile because the remote interface has no getter methods...
Can you tell I am new at this? It feels like I'm not even sure what my problem is... I know, though, that my current JSPs require access to the entity bean's getter methods.
If anyone can help, I'd be really grateful! If I am not making things clear enough, ask and I'll attempt to clarify.
Oyvind
[ October 15, 2003: Message edited by: �yvind Valland ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just add the getter methods?
 
�yvind Valland
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, why don't I do just that! Got it sorted. Thanks Lasse.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!