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

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Reference (javax.naming)
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • 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