Skip to content

Commit

Permalink
Merge pull request #110 from themanwhosold/markus_entw
Browse files Browse the repository at this point in the history
Markus entw
  • Loading branch information
themanwhosold committed Nov 24, 2015
2 parents 1b7da2a + c3cbd85 commit 5eb67b5
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
49 changes: 49 additions & 0 deletions src/main/java/de/hof/se2/sessionBean/DBWriter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package de.hof.se2.sessionBean;

import de.hof.se2.entity.Personen;
import de.hof.se2.managedBean.OutForProfessors;
import de.hof.se2.managedBean.OutForStudents;
import javax.ejb.Singleton;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
* Klasse die alle Schreibvorgänge auf die DB managed
*
* @author markus
* @version 0.1
* @since 24.11.2015
*/
@Singleton
public class DBWriter implements DBWriterLocal {

@PersistenceContext
EntityManager em;

@Inject
OutForStudents outStudents;
OutForProfessors outProfessor;

public DBWriter() {
}

/**
* Schreibt einen Studenten in die Datenbank
*
* @param matrikelNr
* @version 0.1
* @author markus
*/
public void schreibeStudent(int matrikelNr) {
Personen student = em.find(Personen.class, matrikelNr);

em.persist(student);

}
}
17 changes: 17 additions & 0 deletions src/main/java/de/hof/se2/sessionBean/DBWriterLocal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package de.hof.se2.sessionBean;

import javax.ejb.Local;

/**
*
* @author markus
*/
@Local
public interface DBWriterLocal {

}
2 changes: 1 addition & 1 deletion src/main/webapp/StudentOut.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</br>
<br />
<h:commandButton value="Wunschnoten speichern..." action="WunschnotenGespeichert" />
<h:commandButton value="Endnote neu berechnen" />
<h:commandButton value="Endnote neu berechnen" onclick="#{outForStudents.getWunschEndnote(student.getIdPersonen())}"/>
</h:form>
</ui:define>
</ui:composition>
Expand Down

0 comments on commit 5eb67b5

Please sign in to comment.