[jboss-jira] [JBoss JIRA] (AS7-6500) Wrong injection made by container
Scott Marlow (JIRA)
jira-events at lists.jboss.org
Mon Feb 11 12:05:56 EST 2013
[ https://issues.jboss.org/browse/AS7-6500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753470#comment-12753470 ]
Scott Marlow commented on AS7-6500:
-----------------------------------
I deployed the standalone test attached to the bugzilla bug and in JPAAnnotationProcessor.doDeploy(), we get an unordered list of the annotations via:
{code}
List<AnnotationInstance> persistenceContexts = index.getAnnotations(PERSISTENCE_CONTEXT_ANNOTATION_NAME);
persistenceContexts[0]=@javax.persistence.PersistenceContext(unitName = "secondary") on void org.jboss.as.quickstart.hibernate4.service.MemberRegistration.setEm(javax.persistence.EntityManager)
persistenceContexts[1]=@javax.persistence.PersistenceContext(unitName = "secondary") on void org.jboss.as.quickstart.hibernate4.data.SecondaryMemberRepository.setEm(javax.persistence.EntityManager)
persistenceContexts[2]=@javax.persistence.PersistenceContext(unitName = "primary") on void org.jboss.as.quickstart.hibernate4.data.MemberRepository.setEm(javax.persistence.EntityManager)
persistenceContexts[3]=@javax.persistence.PersistenceContext(unitName = "primary") on void org.jboss.as.quickstart.hibernate4.data.BaseDAO.setEm(javax.persistence.EntityManager)
{code}
> Wrong injection made by container
> ---------------------------------
>
> Key: AS7-6500
> URL: https://issues.jboss.org/browse/AS7-6500
> Project: Application Server 7
> Issue Type: Bug
> Components: EE, EJB, JPA / Hibernate
> Affects Versions: 7.1.2.Final (EAP), 7.1.3.Final (EAP), 7.1.4.Final (EAP)
> Reporter: Luan Cestari
> Assignee: Scott Marlow
>
> Description of problem:
> I got an issue in a salesforce case [1] about an incorrect injection.
> [1] https://c.na7.visual.force.com/apex/Case_View?id=500A000000CRqDG&sfdc.override=1
> Version-Release number of selected component (if applicable):
> How reproducible:
> To reproduce the case is required to have two PersistentUnit (PU), a Abstract class with a setter method to inject one PU and others classes inheriting the Abstract class and overriding the setter method to inject a different PU. In the runtime, the container inject twice the PU, first the correct PU and then the PU described in super class.
> I talked with the client (who is a Red Hat consultant) and we made the attached project based on a very simple JBoss example to reproduce the issue which happens in EAP6. I put a lot of 'println' to be very clear (even printing stacktrace to show who is calling). The most important files are:
> -> hibernate4Test/src/main/java/org/jboss/as/quickstart/hibernate4/data/BaseDAO.java -- The abstract class with the default PU injection
> -> hibernate4Test/src/main/java/org/jboss/as/quickstart/hibernate4/data/MemberRepository.java -- BaseDAO subclass
> -> hibernate4Test/src/main/java/org/jboss/as/quickstart/hibernate4/data/SecondaryMemberRepository.java -- BaseDAO subclass
> -> hibernate4Test/src/main/java/org/jboss/as/quickstart/hibernate4/data/MemberListProducer.java -- The class which inject the MemberListProducer and SecondaryMemberRepository
> -> hibernate4Test/src/main/resources/META-INF/persistence.xml -- We changed the configuration here to each PU have a different entity mapped
> Steps to Reproduce:
>
> Actual results:
> The EM injection occurs twice, which the last one the wrong EM.
> Expected results:
> Just one injection occurs.
> Additional info:
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list