1 package ch.ige.edossier.web.server.dao;
2
3 import java.sql.Connection;
4 import java.sql.PreparedStatement;
5 import java.sql.SQLException;
6 import ch.ige.edossier.util.DBHelper;
7 import ch.ige.edossier.web.vo.TMKindDossierVO;
8
9
17 public class TMKindDossierDAO
18 {
19
24 public void insert( TMKindDossierVO tmKindDossierVO ) throws Exception
25 {
26 Connection con = null;
27 PreparedStatement ps = null;
28
29 try
30 {
31 con = DBHelper.getInstance().getEsolutionConnection();
32
33 ps = con.prepareStatement(
34 "INSERT INTO edossier.tmkind_dossier(" +
35 "dossier_id, " +
36 "tmkind_id, " +
37 "language_cd )" +
38 "VALUES(?,?,?)"
39 );
40
41 ps.setInt( 1, tmKindDossierVO.getDossierId() );
42 ps.setInt( 2, tmKindDossierVO.getTmkindId() );
43 ps.setInt( 3, tmKindDossierVO.getLanguageCd() );
44
45 if( ps.executeUpdate() != 1 )
46 {
47 throw new SQLException();
48 }
49
50 }
51 finally
52 {
53 DBHelper.getInstance().close( con, ps );
54 }
55 }
56
57
63 public int delete( int dossierId ) throws SQLException
64 {
65 Connection con = null;
66 PreparedStatement ps = null;
67
68 try
69 {
70 con = DBHelper.getInstance().getEsolutionConnection();
71
72 ps = con.prepareStatement(
73 "DELETE FROM edossier.tmkind_dossier where dossier_id = ? "
74 );
75 ps.setInt( 1, dossierId );
76
77 return ps.executeUpdate();
78 }
79 finally
80 {
81 DBHelper.getInstance().close( con, ps );
82 }
83 }
84 }
85