org.eiichiro.gig.heroku
Class HerokuJPAEntityManagerFactory

java.lang.Object
  extended by org.eiichiro.jazzmaster.Component<javax.persistence.EntityManagerFactory>
      extended by org.eiichiro.gig.heroku.HerokuJPAEntityManagerFactory

@Singleton
public class HerokuJPAEntityManagerFactory
extends org.eiichiro.jazzmaster.Component<javax.persistence.EntityManagerFactory>

HerokuJPAEntityManagerFactory is a representing JPA 2.0 EntityManagerFactory for PostgreSQL-based Heroku database service.

Author:
Eiichiro Uchiumi

Constructor Summary
HerokuJPAEntityManagerFactory()
           
 
Method Summary
 void close()
          Lifecycle callback to close the EntityManagerFactory set.
 void configure()
          Configures JPA's JDBC connection properties from the environment variable 'DATABASE_URL' and gets the persistence units to be connected from a PersistenceXMLProcessor.
 javax.persistence.EntityManagerFactory instance()
          Returns the EntityManagerFactory instance corresponding to the persistence unit the current application connects.
 List<String> persistenceUnits()
           
 Map<String,String> properties()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HerokuJPAEntityManagerFactory

public HerokuJPAEntityManagerFactory()
Method Detail

configure

@Constructed
public void configure()
Configures JPA's JDBC connection properties from the environment variable 'DATABASE_URL' and gets the persistence units to be connected from a PersistenceXMLProcessor.


close

@Passivated
public void close()
Lifecycle callback to close the EntityManagerFactory set.


instance

public javax.persistence.EntityManagerFactory instance()
Returns the EntityManagerFactory instance corresponding to the persistence unit the current application connects. If the PersistenceXMLProcessor detects multiple persistence unit declarations, this class connects the first-detected one (Index 0 of the persistence unit list that the PersistenceXMLProcessor#persistenceUnits() returns). If the current application cannot access to the database service for any reasons, this method returns null. Note: In the future, the implementation will be improved for multitenant applications. The persistence unit set on the current thread via something like "Namespaces API" will be used for the EntityManagerFactory creation.

Specified by:
instance in class org.eiichiro.jazzmaster.Component<javax.persistence.EntityManagerFactory>
Returns:
The EntityManagerFactory instance corresponding to the persistence unit the current application connects.

properties

public Map<String,String> properties()

persistenceUnits

public List<String> persistenceUnits()


Copyright © 2012 Eiichiro Uchiumi. All Rights Reserved.