You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Anthony Insolia (JIRA)" <ji...@apache.org> on 2012/09/13 10:53:08 UTC

[jira] [Created] (GERONIMO-6387) @EJB doesn't work in an EJB annotated with @Entity

Anthony Insolia created GERONIMO-6387:
-----------------------------------------

             Summary: @EJB doesn't work in an EJB annotated with @Entity
                 Key: GERONIMO-6387
                 URL: https://issues.apache.org/jira/browse/GERONIMO-6387
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: dependencies
    Affects Versions: 3.0-beta-1
         Environment: Geronimo 3.0 Beta
JavaEE6 singleton sample
            Reporter: Anthony Insolia


I have an @Singleton bean also annotated @Startup. The singleton is startin gup and it is accessible to other @ManagedBeans that inject the singleton using @EJB.
 
@Startup
@Singleton
@ConcurrencyManagement(BEAN)
public class Factory { 
 private EntityManagerFactory emf = null; 
 private EntityManager entityManager = null;
 etc.
   
and 

@ManagedBean(name = "Credentials")
@SessionScoped
public class Credentials {  
 private User user = null; 
 private String username;  
 private String password;  
 private String company;  
 private String verification = null;  
 private boolean loggedIn = false;
 private InitialContext initialcontext = null; 
@EJB
 private Factory factory; 
 
 public Credentials() {}
 etc.

 work fine: the @EJB resolves the reference to my factory object/singleton. In the same WAR I have an entity bean defined as below and the @EJB doesnt work.
 
@Entity 
@Table(name="user_table")
@ManagedBean(name = "User")
@RequestScoped
public class User extends Particle {
 private long uuid = 0;
@Id
 private long csid = 0;
@EJB
  private Factory factory;
  etc.

I've added an Entity bean to the singleton example and get the same results

--
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