-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from themanwhosold/markus_entw
Markus entw
- Loading branch information
Showing
3 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters