name="com.springlesson09.model.Usuario" table="usuario"> <id name="id" type="java.lang.Integer"> <column name="id"/> <generator class="identity"/> </id> <property name="nome" type="string"> <column length="45" name="nome" not-null="true"/> </property> <property name="email" type="string"> <column length="45" name="email" not-null="true"> <comment>licao 09 - WEB</comment> </column> </property> <property name="senha" type="string"> <column length="45" name="senha" not-null="true"/> </property> </class></hibernate-mapping>Usuario.java :package com.springlesson09.model;// Generated Oct 1, 2012 11:10:44 PM by Hibernate Tools 3.2.1.GA/** * Usuario generated by hbm2java */public class Usuario implements java.io.Serializable { private Integer id; private String nome; private String email; private String senha; public Usuario() { } public Usuario(String nome, String email, String senha) { this.nome = nome; this.email = email; this.senha = senha; } public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } public String getNome() { return this.nome; } public void setNome(String nome) { this.nome = nome; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } public String getSenha() { return this.senha; } public void setSenha(String senha) { this.senha = senha; }}Contato.java :package com.springlesson09.model;// Generated Oct 1, 2012 11:10:44 PM by Hibernate Tools 3.2.1.GA/** * Contato generated by hbm2java */public class Contato implements java.io.Serializable { private Integer id; private String nome; private String telefone; private String email; public Contato() { } public Contato(String nome, String telefone, String email) { this.nome = nome; this.telefone = telefone; this.email = email; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return this.nome; } public void setNome(String nome) { this.nome = nome; } public String getTelefone() { return this.telefone; } public void setTelefone(String telefone) { this.telefone = telefone; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; }}5)-Criando uma interface DAOFigura 24 - Criando uma interfaceFigura 25 - Criando uma interface ContatoDAOContatoDAO.javapackage com.springlesson09.dao;import com.springlesson09.model.Contato;import java.util.List;public interface ContatoDAO {public void saveOrUpdateContato(Contato contato); public List<Contato> listContato(); public Contato listContatoById(Integer contatoId); public void deleteContato(Integer contatoId); }6) Criando a implementacao do DAOFigura 26 - Implementando uma interfaceFigura 27- Implementando uma interface, aproveite o NBContatoDAOImpl.javapackage com.springlesson09.dao;import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;import com.springlesson09.model.Contato;import java.util.List;import org.hibernate.Session;import org.hibernate.Transaction;public class ContatoDAOImpl implements ContatoDAO { @SessionTarget Session session; @TransactionTarget Transaction transaction; /** * * @param contato */ @Override public void saveOrUpdateContato(Contato contato) {// throw new UnsupportedOperationException("Not supported yet."); try { session.saveOrUpdate(contato); } catch (Exception e) { transaction.rollback(); e.printStackTrace(); } } /** * * @return */ @SuppressWarnings("unchecked") @Override public List<Contato> listContato() { List<Contato> courses = null; try { courses = session.createQuery("from Contato").list(); } catch (Exception e) { e.printStackTrace(); } return courses; } @Override public Contato listContatoById(Integer contatoId) { Contato contato = null; try { contato = (Contato) session.get(Contato.class, contatoId); } catch (Exception e) { e.printStackTrace(); } return contato; } @Override public void deleteContato(Integer contatoId) { try { Contato contato = (Contato) session.get(Contato.class, contatoId); session.delete(contato); } catch (Exception e) { transaction.rollback(); e.printStackTrace(); } }}7) Preparando o action (service)Figura 28- Implementando a actionFigura 29- Implementando a actionContatoAction.java :package com.springlesson09.service;import com.opensymphony.xwork2.ActionContext;import com.opensymphony.xwork2.ActionSupport;import com.opensymphony.xwork2.ModelDriven;import com.springlesson09.dao.ContatoDAO;import com.springlesson09.dao.ContatoDAOImpl;import com.springlesson09.model.Contato;import java.util.ArrayList;import java.util.List;import javax.servlet.http.HttpServletRequest;import org.apache.struts2.ServletActionContext;public class ContatoAction extends ActionSupport implements ModelDriven<Contato> { private static final long serialVersionUID = -6659925652584240539L; private Contato contato = new Contato(); private List<Contato> contatoList = new