congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AnnotationSessionFactoryBean.setHibernateProperties
Code IndexAdd Tabnine to your IDE (free)

How to use
setHibernateProperties
method
in
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean

Best Java code snippets using org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.setHibernateProperties (Showing top 8 results out of 315)

origin: madvirus/spring4

@Bean
public LocalSessionFactoryBean sessionFactoryBean() {
  AnnotationSessionFactoryBean sessionFactoryBean = new AnnotationSessionFactoryBean();
  sessionFactoryBean.setDataSource(dataSource());
  sessionFactoryBean.setAnnotatedClasses(Item.class, PaymentInfo.class, PurchaseOrder.class);
  Properties prop = new Properties();
  prop.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5InnoDBDialect");
  sessionFactoryBean.setHibernateProperties(prop);
  return sessionFactoryBean;
}
origin: com.custardsource.dybdob/dybdob-core

public WarningRecordRepository(String jdbcDriver, String jdbcConnection, String jdbcUser, String jdbcPassword, String hibernateDialect) {
  try {
    Class.forName(jdbcDriver);
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Cannot load specified JDBC driver: " + jdbcDriver, e);
  }
  DriverManagerDataSource dataSource=new DriverManagerDataSource(jdbcConnection, jdbcUser, jdbcPassword);
  AnnotationSessionFactoryBean sessionFactoryBean = new AnnotationSessionFactoryBean();
  sessionFactoryBean.setDataSource(dataSource);
  Properties config = new Properties();
  config.setProperty("hibernate.dialect", hibernateDialect);
  config.setProperty("hibernate.connection.autocommit", "true");
  config.setProperty("hibernate.hbm2ddl.auto", "update");
  sessionFactoryBean.setHibernateProperties(config);
  sessionFactoryBean.setAnnotatedClasses(new Class<?>[]{WarningRecord.class});
  try {
    sessionFactoryBean.afterPropertiesSet();
  } catch (Exception e) {
    throw new RuntimeException("Could not set up database connection", e);
  }
  hibernateTemplate = new HibernateTemplate((SessionFactory) sessionFactoryBean.getObject());
}
origin: stackoverflow.com

 AnnotationSessionFactoryBean sfb = new AnnotationSessionFactoryBean();
sfb.setDataSource( ds );
sfb.setHibernateProperties( hibProps);
sfb.setPackagesToScan( ... );
sfb.initialise();
SessionFactory sf = sfb.getObject();
origin: spring-projects/spring-framework-issues

@Bean
public SessionFactory sessionFactory() throws Exception
{
  AnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
  bean.setDataSource(dataSource());
  bean.setPackagesToScan(new String[] {"org.springframework.issues"});
  bean.setHibernateProperties(hibernateProps());
  bean.afterPropertiesSet();
  return bean.getObject();
}
origin: spring-projects/spring-framework-issues

@Bean
public SessionFactory sessionFactory() throws Exception
{
  AnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
  bean.setDataSource(dataSource());
  bean.setPackagesToScan(new String[] {"org.springframework.issues"});
  bean.setHibernateProperties(hibernateProps());
  bean.afterPropertiesSet();
  return bean.getObject();
}
origin: stackoverflow.com

 @Configuration
//@ComponentScan(basePackages = "de.webapp.daocustomer", excludeFilters = {@ComponentScan.Filter(Configuration.class), @ComponentScan.Filter(Controller.class)})
@ImportResource({"classpath*:componentScan.xml","classpath*:properties-config.xml","classpath*:security-context.xml"})
public class AppConfig
{
...
@Bean
public SessionFactory sessionFactory() throws Exception
{
  AnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
  bean.setDataSource(dataSource());
  bean.setPackagesToScan(new String[] {"de.webapp"});
  bean.setHibernateProperties(hibernateProps());
  bean.afterPropertiesSet();
  return bean.getObject();
}
origin: stackoverflow.com

String[] pckage={"com.argus.intenew"};
sessionFactory.setPackagesToScan(pckage);  
sessionFactory.setHibernateProperties(hibProperties());
return sessionFactory; 
origin: stackoverflow.com

 @Bean
public BasicDataSource dataSource(){
    BasicDataSource basicDataSource=new BasicDataSource();
    basicDataSource.addConnectionProperty("destroy-method","close");
    basicDataSource.setDriverClassName("com.mysql.jdbc.Driver");
    basicDataSource.setUsername("root");
    basicDataSource.setUrl("jdbc:mysql://localhost/dbname");
    basicDataSource.setPassword("");
    return basicDataSource;
}

@Bean
public AnnotationSessionFactoryBean sessionFactoryBean(){
    AnnotationSessionFactoryBean asfb=new AnnotationSessionFactoryBean();
    asfb.setDataSource(dataSource());
    asfb.setConfigLocation(new ClassPathResource("hibernate.cfg.xml"));
    asfb.setHibernateProperties(hibernateProperties());

    return asfb;
}
public SessionFactory sessionFactory(){
   return sessionFactoryBean().getObject();
}
private Properties hibernateProperties(){
    Properties properties=new Properties();
    properties.put("dialect","org.hibernate.dialect.MySQLDialect");

    return properties;
 }
org.springframework.orm.hibernate3.annotationAnnotationSessionFactoryBeansetHibernateProperties

Popular methods of AnnotationSessionFactoryBean

  • <init>
  • setDataSource
  • afterPropertiesSet
  • getObject
  • setAnnotatedClasses
  • setPackagesToScan
    Specify packages to search using Spring-based scanning for entity classes in the classpath. This is
  • getHibernateProperties
  • initialise
  • matchesEntityTypeFilter
    Check whether any of the configured entity type filters matches the current class descriptor contain
  • scanPackages
    Perform Spring-based scanning for entity classes.
  • setConfigLocation
  • setConfigLocation

Popular in Java

  • Reactive rest calls using spring rest template
  • getSystemService (Context)
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now