This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

using get/set with entity beans

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, why don't I do just that! Got it sorted. Thanks Lasse.
reply
    Bookmark Topic Watch Topic
  • New Topic