Rev 1423 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1423 | Rev 1553 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package pt.estgp.estgweb.services.sigesimports.oracle.dao; |
1 | package pt.estgp.estgweb.services.sigesimports.oracle.dao; |
2 | 2 | ||
3 | import pt.estgp.estgweb.services.sigesimports.oracle.domain.Aluno; |
3 | import pt.estgp.estgweb.services.sigesimports.oracle.domain.Aluno; |
4 | import pt.estgp.estgweb.services.sigesimports.oracle.domain.AlunoHistorico; |
4 | import pt.estgp.estgweb.services.sigesimports.oracle.domain.AlunoHistorico; |
5 | import pt.estgp.estgweb.services.sigesimports.oracle.domain.Disciplina; |
5 | import pt.estgp.estgweb.services.sigesimports.oracle.domain.Disciplina; |
- | 6 | import pt.estgp.estgweb.services.sigesimports.oracle.domain.Nacionalidade; |
|
6 | 7 | ||
7 | import java.sql.Connection; |
8 | import java.sql.Connection; |
8 | import java.sql.PreparedStatement; |
9 | import java.sql.PreparedStatement; |
9 | import java.sql.ResultSet; |
10 | import java.sql.ResultSet; |
10 | import java.sql.SQLException; |
11 | import java.sql.SQLException; |
11 | import java.util.ArrayList; |
12 | import java.util.ArrayList; |
- | 13 | import java.util.HashMap; |
|
12 | 14 | ||
13 | /** |
15 | /** |
14 | * Created by jorgemachado on 07/01/16. |
16 | * Created by jorgemachado on 07/01/16. |
15 | */ |
17 | */ |
16 | public class AlunoDao extends AbstractDao<Aluno> { |
18 | public class AlunoDao extends AbstractDao<Aluno> { |
Line 31... | Line 33... | ||
31 | 33 | ||
32 | protected 1.5.0/docs/api/java/lang/String.html">String getIdColumn() { |
34 | protected 1.5.0/docs/api/java/lang/String.html">String getIdColumn() { |
33 | return "CD_ALUNO"; |
35 | return "CD_ALUNO"; |
34 | } |
36 | } |
35 | 37 | ||
- | 38 | public HashMap<Integer,Nacionalidade> loadNacionalidades(1.5.0/docs/api/java/sql/Connection.html">Connection conn) throws 1.5.0/docs/api/java/sql/SQLException.html">SQLException { |
|
- | 39 | HashMap<Integer,Nacionalidade> nacionalidades = new HashMap<Integer, Nacionalidade>(); |
|
- | 40 | boolean connWasNull = conn == null; |
|
- | 41 | if (conn == null) { |
|
- | 42 | conn = getCurrentConnection(); |
|
- | 43 | } |
|
- | 44 | 1.5.0/docs/api/java/sql/PreparedStatement.html">PreparedStatement catCMD = conn.prepareStatement("SELECT * FROM SIGES.T_TBNACIONA"); |
|
- | 45 | 1.5.0/docs/api/java/sql/ResultSet.html">ResultSet aReader = catCMD.executeQuery(); |
|
- | 46 | while (aReader.next()) |
|
- | 47 | { |
|
- | 48 | 1.5.0/docs/api/java/lang/Integer.html">Integer nacionalidadeCodigo = getDecimal("CD_NACIONA", aReader); |
|
- | 49 | 1.5.0/docs/api/java/lang/String.html">String nacionalidade = getString("DS_NACIONA",aReader); |
|
- | 50 | 1.5.0/docs/api/java/lang/String.html">String pais = getString("DS_PAIS",aReader); |
|
- | 51 | Nacionalidade nacionalidadeRec = new Nacionalidade(); |
|
- | 52 | nacionalidadeRec.setCodigoNacionalidade(nacionalidadeCodigo); |
|
- | 53 | nacionalidadeRec.setNacionalidade(nacionalidade); |
|
- | 54 | nacionalidadeRec.setPais(pais); |
|
- | 55 | nacionalidades.put(nacionalidadeCodigo,nacionalidadeRec); |
|
- | 56 | ||
- | 57 | } |
|
- | 58 | //close the reader |
|
- | 59 | aReader.close(); |
|
- | 60 | catCMD.close(); |
|
- | 61 | ||
- | 62 | if (connWasNull) |
|
- | 63 | conn.close(); |
|
- | 64 | return nacionalidades; |
|
- | 65 | } |
|
- | 66 | ||
36 | public Aluno load(1.5.0/docs/api/java/sql/ResultSet.html">ResultSet aReader) throws 1.5.0/docs/api/java/sql/SQLException.html">SQLException { |
67 | public Aluno load(1.5.0/docs/api/java/sql/ResultSet.html">ResultSet aReader) throws 1.5.0/docs/api/java/sql/SQLException.html">SQLException { |
37 | Aluno a = new Aluno(); |
68 | Aluno a = new Aluno(); |
38 | a.codigo = getDecimal("CD_ALUNO", aReader); |
69 | a.codigo = getDecimal("CD_ALUNO", aReader); |
39 | //a.nome = getString("NM_ALUNO",aReader); |
70 | //a.nome = getString("NM_ALUNO",aReader); |
40 | a.nome = getString("NM_COMPLETO", aReader); |
71 | a.nome = getString("NM_COMPLETO", aReader); |
- | 72 | a.codigoNacionalidade = getDecimal("CD_NACIONA",aReader); |
|
41 | 73 | ||
42 | //d.nomeFuncionario = getString("NM_COMPLETO", aReader); //ok T_INDIVIDUO FALTA VER O "NOME" |
74 | //d.nomeFuncionario = getString("NM_COMPLETO", aReader); //ok T_INDIVIDUO FALTA VER O "NOME" |
43 | //d.nomeFuncionarioInt = getString("NM_FUNC_INT", aReader); |
75 | //d.nomeFuncionarioInt = getString("NM_FUNC_INT", aReader); |
44 | //d.nomeFuncionario = getString("NM_ABREVIADO", aReader); //ok T_INDIVIDUO |
76 | //d.nomeFuncionario = getString("NM_ABREVIADO", aReader); //ok T_INDIVIDUO |
45 | //d.nomeAcademico = getString("NM_ACADEMICO", aReader); //ok T_INDIVIDUO |
77 | //d.nomeAcademico = getString("NM_ACADEMICO", aReader); //ok T_INDIVIDUO |