JVx EE 1.0.1 is out

Post to Twitter

What is JVx EE?

It is a small library that allows you to create backend applications for your frontends. Simply re-use your existing domain model and create a JVx application that uses a domain model instead of direct database connections.

It's licensed under Apache 2.0 and is available here.

What's new?

We reviewed the code and fixed some smaller bugs. We added an example application that shows how it works.

A short example

Session.java

public EntityManager getEntityManager() throws Exception
{
    EntityManager em = (EntityManager)get("entityManager");
       
    if (em == null)
    {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("jvxee");  
        em = emf.createEntityManager();
           
        put("entityManager", em);
    }
       
    return em;
}

Screen.java

public IStorage getCustomer() throws Exception
{
    JPAStorage jpaCustomer = (JPAStorage)get("customer");

    if (jpaCustomer == null)
    {
        EntityManager em = getEntityManager();
               
        jpaCustomer = new JPAStorage(Customer.class);
        jpaCustomer.setEntityManager(em);
               
        CustomerEAO customerEAO = new CustomerEAO();
        customerEAO.setEntityManager(em);
               
        jpaCustomer.getJPAAccess().setExternalEAO(customerEAO);
        jpaCustomer.open();
               
        put("customer", jpaCustomer);
    }
       
    return jpaCustomer;
}

public IStorage getCustomerEducation() throws Exception
{
    JPAStorage jpaCustomerEducation = (JPAStorage)get("customerEducation");
       
    if (jpaCustomerEducation == null)
    {
        jpaCustomerEducation = new JPAStorage(Customer.class);
        jpaCustomerEducation.setDetailEntity(Education.class);
        jpaCustomerEducation.setEntityManager(getEntityManager());
        jpaCustomerEducation.open();
               
        put("customerEducation", jpaCustomerEducation);
    }
       
    return jpaCustomerEducation;
}