Package edu.wisc.game.sql

## Class Main

- java.lang.Object
- - edu.wisc.game.sql.Main

-     public class Main
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `persistenceUnitName` | This name will be used to configure the EntityManagerFactory based on the corresponding name in the META-INF/persistence.xml file

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Main()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static javax.persistence.EntityManager` | `getEM()` | Creates a new EntityManager from the EntityManagerFactory.
    `static javax.persistence.EntityManagerFactory` | `getFactory()` | Initializes the EntityManagerFactory using the System properties.
    `static int` | `getMyPid()` | Finds the process id of the UNIX process for this application.
    `static javax.persistence.EntityManager` | `getNewEM()` |
    `static void` | `memory()` | Reports memory use
    `static void` | `memory​(String title)` | Reports memory use
    `static String` | `memoryInfo​(String title, boolean doGc)` |
    `static void` | `persistObjects​(Object... v)` | See also https://download.oracle.com/otn-pub/jcp/persistence-2_1-fr-eval-spec/JavaPersistence.pdf, which says (in "3.2.2 Persisting an Entity Instance"): If X is a new entity, it becomes managed.
    `static <T> void` | `saveObject​(T o)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### persistenceUnitName

          public static final String persistenceUnitName

      This name will be used to configure the EntityManagerFactory based on the corresponding name in the META-INF/persistence.xml file
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Main

          public Main()

  - ### Method Detail

    - #### getMyPid

          public static int getMyPid()

      Finds the process id of the UNIX process for this application. FIXME: This obviously is non-portable outside of UNIX.
      Returns:
        PID, or -1 on failure

    - #### getFactory

          public static javax.persistence.EntityManagerFactory getFactory()

      Initializes the EntityManagerFactory using the System properties. The "icd" name will be used to configure based on the corresponding name in the META-INF/persistence.xml file

    - #### getEM

          public static javax.persistence.EntityManager getEM()

      Creates a new EntityManager from the EntityManagerFactory.

    - #### getNewEM

          public static javax.persistence.EntityManager getNewEM()

    - #### memory

          public static void memory()

      Reports memory use

    - #### memory

          public static void memory​(String title)

      Reports memory use

    - #### memoryInfo

          public static String memoryInfo​(String title,
                                          boolean doGc)

    - #### persistObjects

          public static void persistObjects​(Object... v)

      See also https://download.oracle.com/otn-pub/jcp/persistence-2_1-fr-eval-spec/JavaPersistence.pdf, which says (in "3.2.2 Persisting an Entity Instance"):
      - If X is a new entity, it becomes managed. The entity X will be entered into the database at or before transaction commit or as a result of the flush operation.
      - If X is a preexisting managed entity, it is ignored by the persist operation (...)
      - If X is a detached object, the EntityExistsException may be thrown when the persist operation is invoked, or the EntityExistsException or another PersistenceException may be thrown at flush or commit time

    - #### saveObject

          public static <T> void saveObject​(T o)

      Parameters:
        `o` - a detached object