Skip to content
Snippets Groups Projects
Application.java 1.08 KiB
Newer Older
TayBone2305's avatar
TayBone2305 committed
import classes.*;
import enumeration.*;

/**
 * Defines the entry point of the Java application.
 */
public class Application
{
    private static JpaService jpaService = JpaService.getInstance();

    public static void main(String[] args)
    {
        try
        {
            jpaService.runInTransaction(entityManager -> {
                // name, semester, courseType, sws, ects, examType, isCredited
                entityManager.persist(new Course("Numerische Methoden", Semester.SIXTH.getSemester(), CourseType.REQUIRED.getCourseType(), 4, 5, ExamType.WRITTEN.getExamType(), null));
                entityManager.persist(new Course("Echtzeitsysteme", Semester.SIXTH.getSemester(), CourseType.REQUIRED.getCourseType(), 4, 5, ExamType.WRITTEN.getExamType(), null));
                entityManager.persist(new Course("Digitale Signalverarbeitung", Semester.SIXTH.getSemester(), CourseType.REQUIRED.getCourseType(), 4, 5, ExamType.WRITTEN.getExamType(), null));

                return null;
            });
        }
        finally
        {
            jpaService.closeResource();
        }
    }
}