@@ -0,0 +1,4040 @@
+import javax.persistence.EntityManager;%0Aimport javax.persistence.EntityManagerFactory;%0Aimport javax.persistence.Persistence;%0Aimport java.io.*;%0Aimport java.lang.reflect.Field;%0Aimport java.util.Scanner;%0A%0Apublic class ODBCreate %7B%0A%0A    //MODIFY THIS LINE%0A    private static final String oDBfile = %22test.odb%22; //Enter the filename of your ODB, *.odb%0A%0A    //The following declarations contain helper values for reflection mechanism, you can change or add other types, like Date, for example%0A    private static final Integer anInt = 1;%0A    private static final Long aLong = 1L;%0A    private static final Double aDouble = 1.0;%0A    private static final String aString = %221%22;%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner scanner = new Scanner(System.in);%0A        System.out.println(%22Serialize new class - 's', create new entries - 'e' or any other key to exit%22);%0A        String choice = scanner.next();%0A        switch (choice) %7B%0A            case %22s%22:%0A                Serializer.serializeYourClass();%0A                break;%0A            case %22e%22:%0A                System.out.println(%22Enter number of new lines: %22);%0A                int lines = scanner.nextInt();%0A                Object entity_class = null;%0A                try (FileInputStream fileInputStream = new FileInputStream(Serializer.getTargetFile());%0A                     ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream)%0A                ) %7B%0A                    entity_class = objectInputStream.readObject();%0A                %7D catch (FileNotFoundException e) %7B%0A                    e.printStackTrace();%0A                %7D catch (IOException e) %7B%0A                    e.printStackTrace();%0A                %7D catch (ClassNotFoundException e) %7B%0A                    e.printStackTrace();%0A                %7D%0A                EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(oDBfile);%0A                for (int i = 0; i %3C lines; i++) %7B%0A                    EntityManager entityManager = entityManagerFactory.createEntityManager();%0A                    entityManager.getTransaction().begin();%0A                    Field%5B%5D fields = entity_class.getClass().getDeclaredFields();%0A                    for (Field f : fields) %7B%0A                        f.setAccessible(true);%0A                        String s = f.getName();%0A                        System.out.println(%22Please enter the value for %22 + s);%0A                        String val = scanner.next();%0A                        Class%3C?%3E field_type = f.getType();%0A                        try %7B%0A%0A                            //Update these checks for additional types, like Date, etc.%0A                            if (field_type.isInstance(aString)) %7B%0A                                f = setClassField(f, entity_class, val);%0A                            %7D else if (field_type.isPrimitive()) %7B%0A                                f = setClassField(f, entity_class, Long.parseLong(val)); //Change to Integer, if you need%0A                            %7D else if (field_type.isInstance(aLong)) %7B%0A                                f = setClassField(f, entity_class, Long.valueOf(val));%0A                            %7D else if (field_type.isInstance(aDouble)) %7B%0A                                f = setClassField(f, entity_class, Double.valueOf(val));%0A                            %7D%0A                        %7D catch (NumberFormatException ex) %7B%0A                            System.out.println(%22Wrong number format, recording null instead%22);%0A                        %7D%0A                    %7D%0A                    entityManager.persist(entity_class);%0A                    entityManager.getTransaction().commit();%0A                    entityManager.close();%0A                %7D%0A                entityManagerFactory.close();%0A                break;%0A        %7D%0A        scanner.close();%0A    %7D%0A%0A    private static Field setClassField(Field f, Object eclass, Object val) %7B%0A        try %7B%0A            f.set(eclass, val);%0A        %7D catch (IllegalAccessException e) %7B%0A            e.printStackTrace();%0A        %7D%0A        return f;%0A    %7D%0A%7D%0A

Create ODBCreate.java