I have a querry which is a join of two tables is it possible that using CMP i can fire this querry , is there any way by which I can mention two tables in the "weblogic-cmp-rdbms-jar.xml" file and use two blocks of <attribute-map> </attribute-map> two link two tables ???
- Posted by: Sabyasachi Chowdhury
- Posted on: November 18 2002 08:58 EST
I am presently in EJB1.1....is this possible with 1.1 or I have to move to BMP for that or EJB2.0???
Thanx in advance
This is possible (with severe restrictions) with CMP 2.0 entities in WebLogic 7. Both tables must have the same primary key, and individual fields can come from either table. This isn't a general case of a join, so it probably won't meet your needs.
So BMP might be the only option if you want to use entity beans, and you'll need to implement some complex code. You may want to consider why you're using entity beans at all, as they're not a great fit to this problem. My new book, Expert One-on-One J2EE" discusses alternative persistence strategies in detail. I'd consider using a view in the database (if your db supports updateable views), or using JDBC.
You can use CMP EJB based on database VIEW for reading and another CMP EJB for insert/update/delete. It's more work, but this way you don't break your CMP (if you care ;-))
Thanx A lot !!!