Showing posts with label autowiring. Show all posts
Showing posts with label autowiring. Show all posts

Adding a webclient to EJB project

This tutorial goes on where The previous tutorial stopped so please make sure to check it out before reading anay further!

Ok let's get going again, open the ejb project in your intellij IDE and follow these simple steps:

  • Click file -> new module 
  • Create new module from scratch -> next
  • name the module webclient -> next
  • create source directory src -> next
  • select application server and web application (should be checked when you check application server). Again make sure to select your jboss 6.1.0 final server.
  • Click finish

Set up a maven web project in Intellij with Spring and JPA - Part Five

Here we go for part 5 of this tutorial series! This part will cover our Data Acces Object Layer (DAO).
We will be mainly talking about CRUD (create,update,delete) operations using JPA and Spring.


I should start by saying that we will use an Interface and an Implementation for each Entity.
This way we can easily switch database providers later if we would like to.

The PostDao interface:
package blog.dao;

import blog.domain.Post;
import java.util.List;

public interface PostDao {
    List<Post> findAllPosts();
    Post findPostByPostId(Long postId);

    void create(Post post);

    void remove(Post post);

    void update(Post post);

    List<Post> findMostRecentPosts();
}

note that we created crud methods and some other selection methods we'll need later.