net.csdn.jpa
Class JPA
java.lang.Object
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();
|
Constructor Summary |
JPA()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
models
public static final Map<String,Class<Model>> models
JPA
public JPA()
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.