@Bean
 public EntityManagerFactory entityManagerFactory() throws NamingException {
   JndiTemplate jndi = new JndiTemplate();
   EntityManagerFactory emf = (EntityManagerFactory) jndi.lookup("java:/emf");
   return emf;
   // Class works with java beans
 }
Example #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;
   }
 }
Example #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;
   }
 }
Example #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;
   }
 }
Example #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;
   }
 }
Example #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;
   }
 }
Example #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;
   }
 }
Example #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;
   }
 }
Example #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;
 }
Example #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));
 }