5 Replies Latest reply on Oct 19, 2006 9:51 AM by crnflke

    JBoss4.0.4 - Unable to create BMP Entity bean

    crnflke

      I'm a bit confused, and I might be doing something very stupid.

      I want to create an EJB3 Entity Bean that is BMP. I want to be able to access it both as an internal client (from a Message Driven Bean), and also from a remote client that isn't running in the container.

      I can't find any obvious documentation on the web on how to create BMP Entity beans using EJB3, but what I did find was something indicating that there is meant to be a field (entityType) with the Entity annotation that indicates if you want to use BMP. But I can't see this in the jboss ejb libraries.

      Am I missing something obvious?

        • 1. Re: JBoss4.0.4 - Unable to create BMP Entity bean
          wolfgangknauf

          Hi !

          BMPs are not a feature of EJB3 (see the spec at http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html) You can create only BMPs according to the EJB2.1 spec (which is part of the EJB3 spec and should still be supported in JavaEE5 containers).

          That's quite obvious because an Entity bean is now a plain old java object, and it is the job of a Persistence Manager to handle the database access. So the bean is no longer responsible for persisting itself.

          Hope this helps

          Wolfgang[/url]

          • 2. Re: JBoss4.0.4 - Unable to create BMP Entity bean
            crnflke

            Ouch. That sounds quite unpleasant. So I still have to write reams of XML to specify finders and so on.

            Is there any suggested alternative to Entities to hold information that can be looked up via an ID? I can't see an easy way of doing it using sessions and the only way I could see of doing it was entity beans. I was assuming that the final spec would actually fully support Bean Managed Entities or some way of achieving a similar result.

            • 3. Re: JBoss4.0.4 - Unable to create BMP Entity bean
              crnflke

              To reply to myself - is the correct way to do BMPs to actually write an EntityManager? Is such a thing possible? That might be quite a nice solution, although a fair amount of work.

              • 4. Re: JBoss4.0.4 - Unable to create BMP Entity bean
                maxandersen

                yes ....or use an entitymanager (such as Hibernate EntityManager) that allows you to customize almost all parts of the sql used when persisting/querying for objects.

                Why is it exactly you still want BMP ?

                • 5. Re: JBoss4.0.4 - Unable to create BMP Entity bean
                  crnflke

                  I want to wrap a complex object around a File - so it isn't database related at all. I could possibly avoid using entities, but it works quite nicely in some ways.

                  Maybe the right way to do this is just to use a static and something like Stateless Session Beans, but I'm not 100% sure if that is the right approach.