Sorry for saying that but you're kind confused about everything you said since you opened this topic. You do know some of the great features / characteristics that EJB provides but what you don't know is what it really is. You've used transaction and persistence as an example of how you replaced EJB by Hibernate but it's quite impossible to say that. I'll assume that you're using at least EJB 3.0 (because you know, we are in 2012 .. almost EJB 3.2), thus, discard the possibility of you're talking about entity beans, though.
Therefore, you can just be talking about JPA and not EJB that could be "replaced" by Hibernate, but again, that's not true once JPA is the interface / specification and Hibernate could be used as the persistence provider underneath it.
I'll not mention some other parts like what you've affirmed about remotability, modularity and security because I would have to dig deep in how the specification provides hooks to technologies related to these features and which of them worth in my opinion or not. Anyway, I think you should review wherever you've read or concluded all these things while reading about EJB, maybe about Spring and Guice too and consider it all again, otherwise you can be doing it wrong.
The question about static classes over JNDI lookup, you must open your mind dude, you're not in the mainframe era anymore, a static class is in the scope of a single JVM and the remotability achieved through SOAP, REST, RMI, etc.. is just a mean to transfer them, JNDI provides you a mechanism to keep registry of values and objects and get references to them over the network.
Just to finish, I would like to emphasize that unit testing your code doesn't play any role in modularity, modularity is about how you are able to shard your codebase across different units (files mostly) and them still have their responsibility well defined, this is related with tight coupling or loosely coupling and so on. Unit testing just help's you avoid regressing the software features and testing each characteristic of each implementation separately.
Don't take my comments and answer wrong, I just want to help! Ok?
Feel free to ask me anything!
www.BlackBeltFactory.com/ui#!/ref=jmotta, SCJP 6, OCWCD JEE5, OCE EJB JEE6
Jayr Motta wrote:
The question about static classes over JNDI lookup, you must open your mind dude, you're not in the mainframe era anymore, a static class is in the scope of a single JVM
Not completely true. Every class is scoped to the classloader. You can have 2 different instance of the same class loaded by 2 different classloaders in the same JVM. But yes, I understand the point you were trying to make about the JNDI vs static class (which by the way, I think was meant to be a class with static methods) question.