Actually, I have all my jpa-queries within a Stateless Session Bean.
Look at that:
Now, I am wondering what will be the drawbacks,
if I use a static method within the PersistenceBean returning the related Query-Instance to my session bean:
1. What version is better, version 1 or version 2 ? Why?
2. Are there any pitfalls when using entityManager-Instance within a static method?
3. Are there any lacks of performance when using a static method to retrieve a query-instance instead of retrieving it via a typical (non-static) ejb-method (for example, because of pooling or transaction, ..)?
4. In generally, are there any pittfalls, drawbacks, performance losses when using or invoking static methods within a ejb-bean ?
In my opinion, version 2 is better because of maintenance: I have all my query-related things of a object within the object itself. But I am really in doubt about my opinion.