• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

entity beans and multiple tables

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I have already searching on this forum for something about that but found nothing. Maybe It's just a too noooooob question, but I hope someone could help me on this.

I would like to know if some one can help me understand one thing about beans and database tables.

OK,

I have one table and also have a bean that is representation of this table.

I do a select on that table and iterate through the result set creating a new bean for each iteration adding it to an ArrayList. Everything is just fine with that. Things work just like I think they should do.

The problem:
I have the same table, but now I need to do a sort of joins on it.

the question:
Do I have to build a new bean representing all this joins?

ps: I am not using hibernate or any other jpa implementation.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mandrack, please check your private messages.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using EJB 2.1 Entity Beans? BMP or CMP?
 
jose nascimento
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martijn Verburg ,

thanks for reply.

I am using Entity Beans.


I have totally understood using 1 bean x 1 table but things get confused to understand when I have to generate reports, for instance.

Thanks in advance.


regards,

J. Nascimento
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are effectively doing is creating a 'view' for the data. I would recommend creating a Javabean that represents this view and use EJB QL to create and execute a query (whose results can be translated into the Javabean).

Hope that made sense!
 
jose nascimento
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martijn Verburg,

Yes it makes sense.

thanks again.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have one table and also have a bean that is representation of this table



To clarify, an Entity EJB is a temporary, object-oriented representation of a single record in a table, not the entire table.
 
Yup, yup, yup. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic