5 Replies Latest reply on Mar 22, 2010 1:15 AM by jmartin.lanista.gmx.de

    SFSB Interface for EntityHome and EntityQuery

      I had a look on the framework classes EntityHome and EntityQuery. Both look really interesting and I thing they can help reducing the time effort a lot.


      But I couldn't find any interfaces for stateful or stateless session beans. I believe that I am missing something in the concept of using these classes. For testing purposes I used seam-gen to generate a few sample implementations of these classes. Altough I selected EJB/SFSB, the generated classes aren't either annotated with @Stateful nor is there any kind of interface implemented. Is the required code generated at runtime through aspects?


      Can please anybody explain it to me? Why isn't these topic covered in the documentation?

        • 1. Re: SFSB Interface for EntityHome and EntityQuery
          pmuir

          Can please anybody explain it to me? Why isn't these topic covered in the documentation?

          Because it just works:


          @Name("foo")
          @Stateful
          public void FooQuery extends EntityQuery<Foo> implements FooLocal {
          
          ...
          
          }



          @Local
          public interface FooLocal {
          
          // Declare any methods you need, including those from EntityQuery
          
          }

          • 2. Re: SFSB Interface for EntityHome and EntityQuery

            Thanks Pete! Yes, but one always need the same EntityQuery methods in the Local interface (like getResultList()). Why do I need to declare them explicit for each local interface manually? Why isn't there a base interface like IEntityQuery which declares the methods for me?


            I had a look at the seam-gen generated code (I choosed EAR) and saw that the stateful classes dare not annotated with @Stateful and no local interfaces were generated. I thought seam-gen generates SFSB if EAR was choosen? Am I wrong?

            • 3. Re: SFSB Interface for EntityHome and EntityQuery
              pmuir

              Vassiliy Dubkin wrote on Apr 11, 2008 01:04 PM:


              Thanks Pete! Yes, but one always need the same EntityQuery methods in the Local interface (like getResultList()). Why do I need to declare them explicit for each local interface manually? Why isn't there a base interface like IEntityQuery which declares the methods for me?



              File a feature request in JIRA ;-)


              I had a look at the seam-gen generated code (I choosed EAR) and saw that the stateful classes dare not annotated with @Stateful and no local interfaces were generated. I thought seam-gen generates SFSB if EAR was choosen? Am I wrong?


              Not for reverse engineering, no. Again, file a feature request in JIRA.

              • 4. Re: SFSB Interface for EntityHome and EntityQuery
                yasudevil

                Is it really okay to use EntityHome and EntityQuery with a Session Bean?


                I was looking at this post and it seens that EntityHome and EntityQuery weren't made for using with Session Beans.


                • 5. Re: SFSB Interface for EntityHome and EntityQuery
                  jmartin.lanista.gmx.de

                  Vassiliy Dubkin wrote on Apr 11, 2008 13:04:


                  Why isn't there a base interface like IEntityQuery which declares the methods for me?




                  i quess its because you have to write getters of all your entities into the interface.
                  public Employee getEmployee(){}, public Customer getCustomer(){} and so on. otherwise you will get errors property 'employee' not found on type...