• Post Reply Bookmark Topic Watch Topic
  • New Topic

Should dependency work with inherence from an abstract class

 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a project I have created a general abstract class in which I try to inject a entitymanager with @PersistenceContext annotation.

The concrete class which is a child of the abstract class is annoteted with @Stateless and is so a stateless session bean.

Now I tried to use an entitymanager but the injection didn't work. I got the famous NullPointerException.

Should this work. I used JBoss Enterprise Application 4.3.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That version of JBoss was not fully EJB3 spec compliant. So i am not sure whether it was working there. The recent community version of JBoss AS 5.1.0 should have this working.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reaction. So it should work following the specification

I will give the newest JBoSS a try on this behaviour. Is it advisable to upgrade to JBoss 5.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!