Using
JBoss 4.2.1,
Java 6 and
JEE 5.
The basic structure of the offending code is I have a stateless bean using the EntityManager to get a set of entity beans. Those entity beans are using @PersistenceContext.
I have a @PostLoad method in the entity that also uses the EntityManager to get some other beans (I'm going to look into a join, but the fields I need to search over are not the primary key fields so it isn't a standard relationship. If anyone knows how to do that with annotations I'm all ears).
Problem is, the session bean seems to be getting the first set of entities just fine. However, the EntityManager in my entity bean is not getting injected; I get a NullPointerException trying to use it in the @PostLoad.
One thing to note is that the first entity is a subclass of a @MappedSuperclass. I don't think that should have bearing on this, but I could easily be wrong.
So pseudo-code
So all A's contain a list of related B's (but again this is shared by a data value other than the keys so not sure how to map that with annotations yet).
Debug also shows that EntityA is getting populated with all the data from the database, so I know that that is not an issue. And the session bean is using the EntityManager with no problems so my configuration appears correct.
Is this a violation of the spec or something that I don't understand (which is a lot it seems

), or is what I'm presenting viable and there is some other dastardly issue afoot here??
Thanks!
Jason
[ December 04, 2008: Message edited by: jason adam ]