Hello, I have four tables in a relational database.
*First table, called "establishments", contains two fiels "db_establishment_id" and "db_establishment_name".
Here is a sample:
[code]
db_establishment_id(pk) db_establishment_name
---------------------------------------------
1 The black frog
2 The king's head
3 McDonalds
[/code]
*Second table, called "categories", contains two fields "db_category_id" and "db_category_name"
Here is a sample:
[code]
db_category_id(pk) db_category_name
-----------------------------------
1 restaurant
2 pub
[/code]
*Third table, called "establishments_qualifiers", contains two fields "db_establishment_id" and "db_id_category"
Here is a sample:
[code]
db_establishment_id(pk,fk) db_category_id(pk,fk)
--------------------------------------
1 2
2 2
2 1
3 1
[/code]
*Fourth table, called "visitors_comments", contains two fields "db_establishment_id" and "db_comment"
Here is a sample:
[code]
db_establishment_id(pk) db_comment
-----------------------------------
2 nice pub
3 cheap food
3 yok!
[/code]
My question is as follows: does one need four ejbs or can I have a single ejb here? (I'd rather have one). Ideally I'd like ONE ejb as follows:
-int establishement_id
-String name
-List categories
-List comments
How can I have a single ejb with the variables as above? Do I need BMP or CMP?
Thanks in advance and sorry for the length of my post,
Julien Martin.
-
Beginner needs help with modelisation issue (1 messages)
- Posted by: Julien Martin
- Posted on: April 24 2004 09:21 EDT
Threaded Messages (1)
- Beginner needs help with modelisation issue by Paul Strack on April 24 2004 23:25 EDT
-
Beginner needs help with modelisation issue[ Go to top ]
- Posted by: Paul Strack
- Posted on: April 24 2004 23:25 EDT
- in response to Julien Martin
In all the servers I have worked with, a CMP EJB can only be mapped to a "flat" record, that is a query that returns exactly one row (though it can join across multiple tables).
If you use BMP, you get total control of the database mapping and can do whatever you want. You pay a heavy price in extra complexity and reduced performance, though.