service-layer

Should ServiceStack be the service layer in an MVC application or should it call the service layer?

自作多情 提交于 2019-11-26 06:25:12
问题 I\'m creating an MVC website and also intend to create a web API for use both within the website and potentially by third parties. From the MVC controllers I\'ll be calling into a service layer which will contain business logic, act on domain models, perform validation, make infrastructure external service calls etc. The service layer in turn will call into repositories for any database interactions. Now, I like the look of ServiceStack and intend on using it for the Web API - it seems more

Handling service layer exception in Java EE frontend method

我的梦境 提交于 2019-11-26 06:08:38
问题 I maintain a web application that have a page with the JSF tag <f:event . I have rewrote a method in a service class for it to throw a business exception. However, when the business exception is thrown, it isn\'t caught in managed bean and the exception is showed on the page. Seems that my code try/catch doesn\'t work. In XHTML: <f:event listener=\"#{resourceBean.init(enrollment)}\" type=\"preRenderView\" /> Listener method in Managed Bean: private boolean canCreateResource; public void init

Difference between Repository and Service Layer?

佐手、 提交于 2019-11-26 04:02:55
问题 In OOP Design Patterns, what is the difference between the Repository Pattern and a Service Layer? I am working on an ASP.NET MVC 3 app, and am trying to understand these design patterns, but my brain is just not getting it...yet!! 回答1: Repository Layer gives you additional level of abstraction over data access. Instead of writing var context = new DatabaseContext(); return CreateObjectQuery<Type>().Where(t => t.ID == param).First(); to get a single item from database, you use repository

How to inject in @FacesValidator with @EJB, @PersistenceContext, @Inject, @Autowired

倾然丶 夕夏残阳落幕 提交于 2019-11-26 01:47:35
问题 How can I inject a dependency like @EJB , @PersistenceContext , @Inject , @AutoWired , etc in a @FacesValidator ? In my specific case I need to inject a Spring managed bean via @AutoWired : @FacesValidator(\"emailExistValidator\") public class EmailExistValidator implements Validator { @Autowired private UserDao userDao; // ... } However, it didn\'t get injected and it remains null , resulting in java.lang.NullPointerException . It seems that @EJB , @PersistenceContext and @Inject also doesn\

JSF Service Layer

为君一笑 提交于 2019-11-26 00:23:03
问题 I am not sure whether my approach with the MVC environment in JSF is the best way to go. Since I am trying to get the most out of JSF I would like to know how my Service Layer (or Model, speaking in MVC terms) should be \'designed\'. I know the View-Controller ratio should be 1 to 1 (exceptions ruled out). Now in what way should I design my Service Layer? Should I use one big service (don\'t think so)? If not, based on what should I split my services? Note, my Service will be called from the

When is it necessary or convenient to use Spring or EJB3 or all of them together?

☆樱花仙子☆ 提交于 2019-11-25 23:59:42
问题 I\'m a little confused by the mixed use of JSF2+Spring+EJB3 or any combination of those. I know one of the Spring principal characteristics is dependency injection, but with JSF managed beans I can use @ManagedBean and @ManagedProperty anotations and I get dependency injection functionality. With EJB3 I\'m even more confused about when to use it along with JSF or if there is even a reason to use it. So, in what kind of situation would it be a good idea to use Spring+JSF2 or EJB3+JSF2? Until

How to inject in @FacesValidator with @EJB, @PersistenceContext, @Inject, @Autowired

痴心易碎 提交于 2019-11-25 22:32:03
How can I inject a dependency like @EJB , @PersistenceContext , @Inject , @AutoWired , etc in a @FacesValidator ? In my specific case I need to inject a Spring managed bean via @AutoWired : @FacesValidator("emailExistValidator") public class EmailExistValidator implements Validator { @Autowired private UserDao userDao; // ... } However, it didn't get injected and it remains null , resulting in java.lang.NullPointerException . It seems that @EJB , @PersistenceContext and @Inject also doesn't work. How do I inject a service dependency in my validator so that I can access the DB? BalusC The