If you have 2 beans that relate to each other and both must be updated at the same time, is have two CMP beans linked together with a vendor specific tool ok, or would it be better to use a BMP bean to update both tables in one go?
Is there an upper limit on how many CMP beans should be related. Is it 1 etc. Should CMP be used only for non-relating tables for updates?
Cheers.
-
Number of tables; BMP or CMP for entity beans? (6 messages)
- Posted by: Nick Stephens
- Posted on: June 19 2001 03:28 EDT
Threaded Messages (6)
- Number of tables; BMP or CMP for entity beans? by Rich Boyde on June 19 2001 10:01 EDT
- Number of tables; BMP or CMP for entity beans? by Albert Zamus on June 19 2001 11:11 EDT
- Number of tables; BMP or CMP for entity beans? by Nick Stephens on June 20 2001 02:41 EDT
-
Number of tables; BMP or CMP for entity beans? by Albert Zamus on June 20 2001 09:20 EDT
-
Number of tables; BMP or CMP for entity beans? by Nick Stephens on June 20 2001 09:24 EDT
- Number of tables; BMP or CMP for entity beans? by Albert Zamus on June 20 2001 10:03 EDT
-
Number of tables; BMP or CMP for entity beans? by Nick Stephens on June 20 2001 09:24 EDT
-
Number of tables; BMP or CMP for entity beans? by Albert Zamus on June 20 2001 09:20 EDT
- Number of tables; BMP or CMP for entity beans? by Nick Stephens on June 20 2001 02:41 EDT
-
Number of tables; BMP or CMP for entity beans?[ Go to top ]
- Posted by: Rich Boyde
- Posted on: June 19 2001 10:01 EDT
- in response to Nick Stephens
When you say the same time, do you mean simultaneous update? Or do you mean concurrently as in table 1 is updated and within the same transaction table 2 is updated .. these are two different scenarios and would require to different solutions.
rich -
Number of tables; BMP or CMP for entity beans?[ Go to top ]
- Posted by: Albert Zamus
- Posted on: June 19 2001 11:11 EDT
- in response to Nick Stephens
I assume here that you have two beans which map to two tables with a possible join. Typically, I think these cases cannot be handled by CMP since you cannot specify more than one table for the bean unless I am missing something. BMP's are preferred if the dependency is pretty simple otherwise use a OR mapping tool like top link if you have number of foreign key specifications in the RDB. -
Number of tables; BMP or CMP for entity beans?[ Go to top ]
- Posted by: Nick Stephens
- Posted on: June 20 2001 02:41 EDT
- in response to Albert Zamus
1 table per bean, with a join on a foreign key and I want to update both of them in one update. There is not more than 1 table per bean. So I can use CMP, but is BMP better for this sort of situation?
Should I only use CMP when I have 1 table and no joins off that table. When I have foreign key mappings, use BMP as a rule?
Cheers. -
Number of tables; BMP or CMP for entity beans?[ Go to top ]
- Posted by: Albert Zamus
- Posted on: June 20 2001 09:20 EDT
- in response to Nick Stephens
thats right. The AS may optimize queries, do caching, batch updates which generally u would have to do by hand. So it would make sense to use CMP for 1 table per bean and use BMP only if you have joins. Besides BMP is pretty bad for being scattered all over the place if you are going to make every bean persist itself. But in any case never use a mix of BMP, CMP weblogic or for that matter any AS can get confused and you can get data inconsistensies because all AS's use deferred updates and BMP's update generally real time. All this can be part of your design nevertheless -
Number of tables; BMP or CMP for entity beans?[ Go to top ]
- Posted by: Nick Stephens
- Posted on: June 20 2001 09:24 EDT
- in response to Albert Zamus
I take it you mean don't mix BMP and CMP in the same tranasaction, but you can use both BMP and CMP beans in an application. Yeah? -
Number of tables; BMP or CMP for entity beans?[ Go to top ]
- Posted by: Albert Zamus
- Posted on: June 20 2001 10:03 EDT
- in response to Nick Stephens
No No I mean dont use BMP and CMP to update some common table. There may be a user bean updating user address table and may be some other bean updating the same table. Now if you mix the two, this can lead to inconsistencies as the AS can potentially cache or deferred updates. And obviously this includes updates within the same transaction as well. To summarize as long as the tables are disjoint and there is no overlaps you can use both but if you have overlaps you are better off using one of the methods.