6 Replies Latest reply on Apr 26, 2003 9:34 AM by juhalindfors

    what to do when EJBQL doesn't cut it.

    ben2

      I am working on an application that is cross-database and cross-application server. I use CMP entity beans for all my data.

      I have a few instances where I need finders where standard EJBQL doesn't cut it.

      What are the implications of writing some code which used standard JDBC calls to get a collection of PK values and then iterated over that and do a findByPK?

      I have not tried this but I would have to assume that it would work, but I am not sure about the effects of bypassing the container are.

      What about in a clustered environment?

        • 1. Re: what to do when EJBQL doesn't cut it.
          ben2

          Is switching to BMP my only option here?

          • 2. Re: what to do when EJBQL doesn't cut it.

            you can try JBossQL, declared SQL or just providing your own finder implementation within CMP bean as well, depending what it is that you need to do in SQL

            • 3. Re: what to do when EJBQL doesn't cut it.
              ben2

              I need this to work on a variety of app servers so I would prefer not to use JBossQL, and it is my understanding that declared SQL has the same limitation.

              Can you point me to a reference on implementing a custom finder for a CMP bean, and is this a JBoss thing or do all app servers support it?

              Thanks,
              Ben

              • 4. Re: what to do when EJBQL doesn't cut it.

                All of the above are specific to JBoss.

                EJBQL is really quite limited and I don't know how feasible it is to use it to build full scale applications. The only option (in J2EE) besides EJBQL is to revert back to BMP, which is not a very good option.

                Quite frankly, I'd rather recommend you use the small additions that are provided by JBOSSQL and then if you actually need to port to another server, worry about converting your beans to BMP or to other app server specific query extensions.

                • 5. Re: what to do when EJBQL doesn't cut it.
                  ben2

                  So, back to my original question. What are the implications of hand writing some JDBC which looks up the primary keys and then doing a findByPK with that key? This would only be used for cases where EJBQL does not work.

                  I can't see any reason why this would be a problem with the container.

                  • 6. Re: what to do when EJBQL doesn't cut it.

                    Shouldn't be a problem.