2 Replies Latest reply on Jun 12, 2009 9:54 AM by Arbi Sookazian

    more binding types

    Arbi Sookazian Master

      For example, this is neither typesafe, nor very readable:

      @PersistenceContext(unitName="userDB") EntityManager em;

      So in JSR-299, you can write this instead:

      @UserDatabase EntityManager em;

      that's from GKing's latest in.relation.to post.

      I'm still struggling with binding types.

      Perhaps the definition of the binding type for @UserDatabase is as follows:

      public @interface UserDatabase{}

      So how does @UserDatabase become a replacement for @PersistenceContext all of a sudden?

      ie. how does the container know to inject an EntityManager instance with @UserDatabase?

      yes, I'm reading the spec, but I still don't get it...