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

TayBone2305's avatar
TayBone2305 committed
import java.time.Duration;

TayBone2305's avatar
TayBone2305 committed
/**
 * 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
TayBone2305's avatar
TayBone2305 committed
                //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));
                //int id, String name, String degree, int duration, int fees, String fieldOfStudy
                CoursesOfStudy coursesOfStudy = new CoursesOfStudy("Angewandte Informatik", Degree.BACHELOR_OF_SCIENCE.getDegree(), 7, 62, FieldOfStudy.B_ACS_EMBEDDED_SYSTEMS.getFieldOfStudy());

                coursesOfStudy.addCourse(new Course("Systemprogrammierung", Semester.SIXTH.getSemester(), CourseType.REQUIRED.getCourseType(), 4, 5, ExamType.WRITTEN.getExamType(), null));

                entityManager.persist(coursesOfStudy);
TayBone2305's avatar
TayBone2305 committed

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