Tabnine Logo
AnnotationSessionFactoryBean.setAnnotatedClasses
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: stackoverflow.com

 @Bean
  public AnnotationSessionFactoryBean sessionFactoryBean() {
...
    AnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
    bean.setAnnotatedClasses(new Class[]{Region.class});
...
    return bean;
  }
origin: stackoverflow.com

AnnotationSessionFactoryBean lsfb = new AnnotationSessionFactoryBean();
Class [] annotatedClasses =  {Student.class};
lsfb.setAnnotatedClasses(annotatedClasses);
origin: stackoverflow.com

 AnnotationSessionFactoryBean sessionFactoryBean = new AnnotationSessionFactoryBean();
//set annotated classes.
sessionFactoryBean.setAnnotatedClasses(new Class<?>[]{VO1.class,VO2.class});
Properties props = new Properties();
//put all your hibernate configurations here

props.setProperty("dataSource.show_sql", "true");
props.setProperty("dataSource.dialect", "org.hibernate.dialect.MySQL5Dialect");
....
sessionFactoryBean.setHibernateProperties(props);

//Create DataSource Dynamically
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(...);
dataSource.setUrl(...);
dataSource.setUsername(...);
dataSource.setPassword(...);

sessionFactoryBean.setDataSource(ds);

//tell sessionFactoryBean that you are ready.
sessionFactoryBean.afterPropertiesSet();
SessionFactory sessionFactory = sessionFactoryBean.getObject();

HibernateTemplate template = new HibernateTemplate();
template.setSessionFactory(sessionFactory);
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());
}
org.springframework.orm.hibernate3.annotationAnnotationSessionFactoryBeansetAnnotatedClasses

Javadoc

Specify annotated classes, for which mappings will be read from class-level annotation metadata.

Popular methods of AnnotationSessionFactoryBean

  • <init>
  • setDataSource
  • setHibernateProperties
  • afterPropertiesSet
  • getObject
  • 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

  • Parsing JSON documents to java classes using gson
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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