Mixing CMP and BMP in the same Entity

Discussions

EJB programming & troubleshooting: Mixing CMP and BMP in the same Entity

  1. Mixing CMP and BMP in the same Entity (2 messages)

    Hi,

    having recently joined a new company, I'm having a look through the existing code base, and have come across something that seems rather odd:

    There are Entity Beans (1.1), which are used as CMP beans. There are a number of finder methods, one of which is declared int the deployment descriptor (the findAll method), and all the rest are written as ejbFinder methods in the Bean's implementation!

    This seems like a mix of CMP and BMP, and I'm not quite sure how the container would feel about this? The beans work fine.

    The app server being run is Borland Enterprise Server 5.1

    My question is this; Is declaring an Entity Bean as CMP in EJB 1.1 merely pointing out that the fields declared in the descriptors are to be container managed, but allow descriptor declared finder methods and ejbFinder methods to be run at the same time?

    I would have thought the container would not allow the mixing of the two, and expect the finders to be dealt with in the deployment descriptor for CMP beans?
     
    Thanks for your time,
    Paul
  2. The app server being run is Borland Enterprise Server 5.1

    My question is this; Is declaring an Entity Bean as CMP in EJB 1.1 merely pointing out that the fields declared in the descriptors are to be container managed, but allow descriptor declared finder methods and ejbFinder methods to be run at the same time?


    Yes, it is possible for finders. Finder implemented in code take precedence over query specified in deployment description. I've used such approach with JBoss 2.4 / 3.x successfully (however, it is not certified yet :-)

    VS
  3. Thanks Valery,

    quite interesting that they take precedence. I have to say I'm not a fan of this, it seems to muddle up the concepts, and will definately look to taking out the programmatic finders and replacing with declarative.

    However, this is easy for me as I can see a quick way to get round the original requirement for the programatic finders, I suppose if the required SQL to get an instance fo an Entity was very complex then this apprach may be of use.

    Certified isn't always a requirement ;)

    Cheers,
    Paul