net.csdn.jpa
Class JPA

java.lang.Object
  extended by net.csdn.jpa.JPA

public class JPA
extends Object

User: WilliamZhu Date: 12-6-26 Time: 下午9:46 Since it is difficult to manager POJOS generated by JPA(Actually you can use AOP).Here we use this class to create +EntityManagerFactory+,to get +EntityManager+ which do persistence and query staff. It is also a holder of some Persistence Infos.

//find the config file InputStream inputStream = Main.class.getResourceAsStream("application_for_test.yml"); Settings settings = InternalSettingsPreparer.simplePrepareSettings(ImmutableSettings.Builder.EMPTY_SETTINGS, inputStream);

//configure ORM JPA.CSDNORMConfiguration csdnormConfiguration = new JPA.CSDNORMConfiguration("development", settings, Main.class.getClassLoader()); JPA.configure(csdnormConfiguration);

//finally load all you model JPA.loadModels();

//then you can use you pojo now Tag.findAll();


Nested Class Summary
static class JPA.CSDNORMConfiguration
           
static class JPA.JPAModelLoader
           
 
Field Summary
static Map<String,Class<Model>> models
           
 
Constructor Summary
JPA()
           
 
Method Summary
static ClassLoader classLoader()
           
static javassist.ClassPool classPool()
           
static void configure(JPA.CSDNORMConfiguration csdnormConfiguration)
           
static DBInfo dbInfo()
           
static DBType dbType()
           
static net.csdn.common.env.Environment environment()
           
static JPAConfig getJPAConfig()
           
static com.google.inject.Injector injector()
           
static void injector(com.google.inject.Injector injector)
           
static void loadModels()
           
static String mode()
           
static Map<String,String> properties()
           
static void setJPAConfig(JPAConfig _jpaConfig)
           
static net.csdn.common.settings.Settings settings()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

models

public static final Map<String,Class<Model>> models
Constructor Detail

JPA

public JPA()
Method Detail

configure

public static void configure(JPA.CSDNORMConfiguration csdnormConfiguration)

getJPAConfig

public static JPAConfig getJPAConfig()

setJPAConfig

public static void setJPAConfig(JPAConfig _jpaConfig)

classLoader

public static ClassLoader classLoader()

mode

public static String mode()

classPool

public static javassist.ClassPool classPool()

injector

public static com.google.inject.Injector injector()

settings

public static net.csdn.common.settings.Settings settings()

environment

public static net.csdn.common.env.Environment environment()

dbType

public static DBType dbType()

dbInfo

public static DBInfo dbInfo()

properties

public static Map<String,String> properties()

loadModels

public static void loadModels()

injector

public static void injector(com.google.inject.Injector injector)


Copyright © 2014. All Rights Reserved.