File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
src/main/java/br/com/ifba/giovaneneves/oopregistrationproject/dao Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 99//--+ END Imports +--//
1010
1111public class StudentDAOImpl extends StudentDAO {
12- private final ConnectionFactory connectionFactory ;
12+ private ConnectionFactory connectionFactory ;
1313
14- public StudentDAOImpl (){
14+ public ConnectionFactory getConnectionFactory () {
15+ return connectionFactory ;
16+ }
1517
16- connectionFactory = new ConnectionFactory ();
18+ public void setConnectionFactory (ConnectionFactory connectionFactory ) {
19+ this .connectionFactory = connectionFactory ;
1720 connectionFactory .connect ();
21+ }
22+
23+ public StudentDAOImpl (){
24+
25+ this .setConnectionFactory (new ConnectionFactory ());
1826
1927 }
2028
@@ -26,7 +34,7 @@ public StudentDAOImpl(){
2634 @ Override
2735 public List <Student > listStudents (){
2836
29- EntityManager entityManager = connectionFactory .getEntityManager ();
37+ EntityManager entityManager = this . getConnectionFactory () .getEntityManager ();
3038
3139
3240 return entityManager .createQuery ("SELECT s FROM Student s" , Student .class ).getResultList ();
You can’t perform that action at this time.
0 commit comments