Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

design decision: variation of session fassade

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:






My Questions:

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic