@Bean
 public EntityManagerFactory entityManagerFactory() throws NamingException {
   JndiTemplate jndi = new JndiTemplate();
   EntityManagerFactory emf = (EntityManagerFactory) jndi.lookup("java:/emf");
   return emf;
   // Class works with java beans
 }
Ejemplo n.º 2
0
 /** Resolves the hibernate hibernate.cache.use_second_level_cache */
 public String resolveHibernateUseSecondLevelCache() {
   JndiTemplate jndi = new JndiTemplate();
   try {
     return (String) jndi.lookup(CommonConstants.JNDI_PROP_HIBERNATE_SECOND_LEVEL_CACHE);
   } catch (NamingException e) {
     return CommonConstants.HIBERNATE_DEFAULT_SECOND_LEVEL_CACHE;
   }
 }
Ejemplo n.º 3
0
 /** Resolves the hibernate hibernate.cache.use_query_cache */
 public String resolveHibernateUseQueryCache() {
   JndiTemplate jndi = new JndiTemplate();
   try {
     return (String) jndi.lookup(CommonConstants.JNDI_PROP_HIBERNATE_QUERY_CACHE);
   } catch (NamingException e) {
     return CommonConstants.HIBERNATE_DEFAULT_QUERY_CACHE;
   }
 }
Ejemplo n.º 4
0
 /** Resolves the hibernate hibernate.hbm2ddl.auto property */
 public String resolveHibernateHbm2ddlAuto() {
   JndiTemplate jndi = new JndiTemplate();
   try {
     return (String) jndi.lookup(CommonConstants.JNDI_PROP_HIBERNATE_HBM2DDL_AUTO);
   } catch (NamingException e) {
     return CommonConstants.HIBERNATE_DEFAULT_HBM2DDL_AUTO;
   }
 }
Ejemplo n.º 5
0
 /** Resolves the hibernate hibernate.format_sql property */
 public String resolveHibernateFormatSql() {
   JndiTemplate jndi = new JndiTemplate();
   try {
     return (String) jndi.lookup(CommonConstants.JNDI_PROP_HIBERNATE_FORMAT_SQL);
   } catch (NamingException e) {
     return CommonConstants.HIBERNATE_DEFAULT_FORMAT_SQL;
   }
 }
Ejemplo n.º 6
0
 /** Resolves the hibernate dialect via JNDI, hibernate property: hibernate.dialect */
 public String resolveHibernateDialect() {
   JndiTemplate jndi = new JndiTemplate();
   try {
     return (String) jndi.lookup(CommonConstants.JNDI_PROP_HIBERNATE_DIALECT);
   } catch (NamingException e) {
     return CommonConstants.HIBERNATE_DEFAULT_DIALECT;
   }
 }
Ejemplo n.º 7
0
 /**
  * Resolves the hibernate connection isolation via JNDI, hibernate property:
  * hibernate.connections.isolation
  */
 public String resolveHibernateConnectionIsolation() {
   JndiTemplate jndi = new JndiTemplate();
   try {
     return (String) jndi.lookup(CommonConstants.JNDI_PROP_HIBERNATE_CONNECTION_ISOLATION);
   } catch (NamingException e) {
     return CommonConstants.HIBERNATE_DEFAULT_CONNECTION_ISOLATION;
   }
 }
Ejemplo n.º 8
0
 /** Resolves the email disabled */
 public String resolveEmailDisabled() {
   JndiTemplate jndi = new JndiTemplate();
   try {
     return (String) jndi.lookup(CommonConstants.JNDI_PROP_EMAIL_DISABLED);
   } catch (NamingException e) {
     return CommonConstants.EMAIL_DEFAULT_DISABLED;
   }
 }
Ejemplo n.º 9
0
 @Bean
 public NamedParameterJdbcTemplate initializeDataSource1() {
   DataSource dataSource = null;
   JndiTemplate jndi = new JndiTemplate();
   NamedParameterJdbcTemplate namedParameterJdbcTemplate = null;
   try {
     dataSource = (DataSource) jndi.lookup("java:comp/env/jdbc/postgresql/postgres");
     namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
   } catch (NamingException e) {
     e.printStackTrace();
   }
   return namedParameterJdbcTemplate;
 }
Ejemplo n.º 10
0
 /*
  * Constructor called when a DataSource object to be obtained from Jndi.
  */
 public JdbcProducer(JndiTemplate jndiTemplate, String dataSourceName)
     throws ClassNotFoundException, JdbcException, NamingException {
   this((DataSource) jndiTemplate.lookup(dataSourceName));
 }