EJB vs JPA controller?
Sun's Bluperint reference implementation of Pet store is built on the JPA Controller pattern. I find no official EJB blueprints whatsoever.
When should you choose an EJB session bean vs a simple JPA controller? Should / could yo开发者_StackOverflowu use both?
Also, are there any server side validation patterns for both options? I know Java EE 6 has something in this regard, but I'm interested in Java EE 5 patterns for various reasons.
For the first part of your question, maybe the following links are useful for understanding when to use EJB and JPA and when to use them together:
- Database table access via JPA Vs. EJB in a Web-Application
- EJB 3 or Hibernate 3
As for the second part, I assume you're referring to Bean Validation
? In Java EE 5 there isn't quite anything like that. What it does have is a system for attaching validators to input fields in the web layer; the JSF validators. This surely is "server side validation".
精彩评论