Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-9400

Tooling shows warning for Seam 3 Persistence created EntityManager injection

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.3.0.M2
    • Fix Version/s: 3.3.0.M3
    • Component/s: cdi-extensions
    • Labels:
      None

      Description

      Create SMPC in Seam 3 Persistence module as shown here http://docs.jboss.org/seam/3/persistence/latest/reference/en-US/html/persistence.html#persistence.seam-managed-persistence-contexts

      @Inject
      EntityManager em;

      Shows "No bean is eligible for injection to the injection point [JSR-299 §5.2.1]" warning

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            akazakov Alexey Kazakov added a comment -

            What we should do:

            If there is a Seam Persistence module in the project classpath (org.jboss.seam.persistence.ManagedPersistenceContextExtension extension) and ExtensionManaged producer is defined in the project then we should provide a built-in bean with EntityManager type and qualifiers and scope defined for this producer. See an example of such a producer:

            @ExtensionManaged
            @Produces
            @PersistenceUnit
            @ConversationScoped
            EntityManagerFactory producerField;
            

            where @ExtensionManaged indicates that this producer forces Seam to provide an EntityManager bean with the listed qualifiers and scope.
            There may be a few producers for EntityManagerFactory with different set of qualifiers. So we also should provide the corresponding bean for every producer.
            If such a producer has SessionFactory type instead of EntityManagerFactor and there is org.jboss.seam.persistence.hibernate.HibernateManagedSessionExtension extension in the project classpath then we should provide Session bean instead of EntityManager.

            Show
            akazakov Alexey Kazakov added a comment - What we should do: If there is a Seam Persistence module in the project classpath (org.jboss.seam.persistence.ManagedPersistenceContextExtension extension) and ExtensionManaged producer is defined in the project then we should provide a built-in bean with EntityManager type and qualifiers and scope defined for this producer. See an example of such a producer: @ExtensionManaged @Produces @PersistenceUnit @ConversationScoped EntityManagerFactory producerField; where @ExtensionManaged indicates that this producer forces Seam to provide an EntityManager bean with the listed qualifiers and scope. There may be a few producers for EntityManagerFactory with different set of qualifiers. So we also should provide the corresponding bean for every producer. If such a producer has SessionFactory type instead of EntityManagerFactor and there is org.jboss.seam.persistence.hibernate.HibernateManagedSessionExtension extension in the project classpath then we should provide Session bean instead of EntityManager.
            Hide
            scabanovich Viacheslav Kabanovich added a comment -

            Alexey, please verify.

            Show
            scabanovich Viacheslav Kabanovich added a comment - Alexey, please verify.
            Hide
            akazakov Alexey Kazakov added a comment -

            I found three issues during validating the fix.
            Two of them are not caused by the code added to fix the issue: JBIDE-9484 and JBIDE-9483
            They are related to general mechanism of CDI extension loading .
            And the 3rd one is a minor issue of loading Seam Persistence extensions. We create both EntityManager and Session beans if org.jboss.seam.persistence.ManagedPersistenceContextExtension service implementation is declared in META-INF which is not 100% correct since this extension should create only a bean for EntityManager and another extension org.jboss.seam.persistence.hibernate.HibernateManagedSessionExtension should create a bean for Session. But both of these extensions are declared in the same JAR, so we decided not to separate these extensions due to performance issues.
            So i'm resolving the issue.

            Show
            akazakov Alexey Kazakov added a comment - I found three issues during validating the fix. Two of them are not caused by the code added to fix the issue: JBIDE-9484 and JBIDE-9483 They are related to general mechanism of CDI extension loading . And the 3rd one is a minor issue of loading Seam Persistence extensions. We create both EntityManager and Session beans if org.jboss.seam.persistence.ManagedPersistenceContextExtension service implementation is declared in META-INF which is not 100% correct since this extension should create only a bean for EntityManager and another extension org.jboss.seam.persistence.hibernate.HibernateManagedSessionExtension should create a bean for Session. But both of these extensions are declared in the same JAR, so we decided not to separate these extensions due to performance issues. So i'm resolving the issue.
            Hide
            jjankovi Jaroslav Jankovič added a comment -

            verified in JBoss Developer Studio 5.0.0.v201109071858R-H28-M3

            Show
            jjankovi Jaroslav Jankovič added a comment - verified in JBoss Developer Studio 5.0.0.v201109071858R-H28-M3
            Hide
            clerum Cody Lerum added a comment -

            This is an issue again because the annotation @ExtensionManaged was moved from org.jboss.seam.solder.core.ExtensionManaged to org.jboss.solder.core.ExtensionManaged in Seam 3.1 Beta3

            Show
            clerum Cody Lerum added a comment - This is an issue again because the annotation @ExtensionManaged was moved from org.jboss.seam.solder.core.ExtensionManaged to org.jboss.solder.core.ExtensionManaged in Seam 3.1 Beta3
            Hide
            jjankovi Jaroslav Jankovič added a comment -

            Verified with jbdevstudio-product-eap-universal-5.0.0.v20120605-0238-H182-CR1.

            Show
            jjankovi Jaroslav Jankovič added a comment - Verified with jbdevstudio-product-eap-universal-5.0.0.v20120605-0238-H182-CR1.

              People

              • Assignee:
                jjankovi Jaroslav Jankovič
                Reporter:
                clerum Cody Lerum
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development