@@ -0,0 +1,2428 @@
+import com.tutorialspoint.entity.Book;%0Aimport java.sql.Connection;%0Aimport java.sql.DriverManager;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0Aimport java.sql.Statement;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport javax.ejb.Stateless;%0A%0A@Stateless%0Apublic class LibraryPersistentBean implements LibraryPersistentBeanRemote %7B%0A    %0A   public LibraryPersistentBean()%7B%0A   %7D%0A%0A   public void addBook(Book book) %7B%0A      Connection con = null;%0A      String url = %22jdbc:postgresql://localhost:5432/postgres%22;%0A      String driver = %22org.postgresql.driver%22;%0A%0A      String userName = %22sa%22;%0A      String password = %22sa%22;%0A      List%3CBook%3E books = new ArrayList%3CBook%3E();%0A      try %7B%0A%0A         Class.forName(driver).newInstance();%0A         con = DriverManager.getConnection(url , userName, password);%0A%0A         PreparedStatement st = %0A         con.prepareStatement(%22insert into book(name) values(?)%22);%0A         st.setString(1,book.getName());%0A%0A         int result = st.executeUpdate();                %0A%0A      %7D catch (SQLException ex) %7B%0A         ex.printStackTrace();%0A      %7D catch (InstantiationException ex) %7B%0A         ex.printStackTrace();%0A      %7D catch (IllegalAccessException ex) %7B%0A         ex.printStackTrace();%0A      %7D catch (ClassNotFoundException ex) %7B%0A         ex.printStackTrace();%0A      %7D    %0A   %7D    %0A%0A   public List%3CBook%3E getBooks() %7B%0A      Connection con = null;%0A      String url = %22jdbc:postgresql://localhost:5432/postgres%22;%0A      String driver = %22org.postgresql.driver%22;%0A   %0A      String userName = %22sa%22;%0A      String password = %22sa%22;%0A      List%3CBook%3E books = new ArrayList%3CBook%3E();%0A      try %7B%0A%0A         Class.forName(driver).newInstance();%0A         con = DriverManager.getConnection(url , userName, password);%0A%0A         Statement st = con.createStatement();%0A         ResultSet rs = st.executeQuery(%22select * from book%22);%0A%0A         Book book;%0A         while (rs.next()) %7B%0A            book = new Book();%0A            book.setId(rs.getInt(1));                 %0A            book.setName(rs.getString(2));%0A            books.add(book);%0A         %7D%0A      %7D catch (SQLException ex) %7B%0A         ex.printStackTrace();%0A      %7D catch (InstantiationException ex) %7B%0A         ex.printStackTrace();%0A      %7D catch (IllegalAccessException ex) %7B%0A         ex.printStackTrace();%0A      %7D catch (ClassNotFoundException ex) %7B%0A         ex.printStackTrace();%0A      %7D%0A      return books;%0A   %7D%0A%7D%0A

Create LibraryPersistentBean.java