Answers for "Explain the Stored Procedure"

2

Explain the Stored Procedure

Stored Procedure :
A stored procedure is a prepared SQL code that you can save, 
so the code can be reused over and over again.

So if you have an SQL query that you write over and over again, 
save it as a stored procedure, and then just call it to execute it.

You can also pass parameters to a stored procedure, 
so that the stored procedure can act based on the parameter value(s) 
that is passed.
Posted by: Guest on July-10-2021
0

Stored-Procedure

@EnableJpaRepositories
@ComponentScan
@Configuration
public class AppConfig {

  @Bean
  public DataSource dataSource() {
      return new EmbeddedDatabaseBuilder()
              .setType(EmbeddedDatabaseType.HSQL)
              .addScript("create-tables.sql")
              .addScript("procedure.sql")
              .setSeparator("/;")
              .build();
  }

  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
      LocalContainerEntityManagerFactoryBean factory =
              new LocalContainerEntityManagerFactoryBean();
      factory.setPersistenceProviderClass(HibernatePersistenceProvider.class);
      factory.setDataSource(dataSource());
      Properties properties = new Properties();
      properties.setProperty("hibernate.hbm2ddl.auto", "update");
      factory.setJpaProperties(properties);
      return factory;
  }

  @Bean
  public PlatformTransactionManager transactionManager() {
      JpaTransactionManager txManager = new JpaTransactionManager();
      txManager.setEntityManagerFactory(entityManagerFactory().getObject());
      return txManager;
  }
}
Posted by: Guest on June-10-2021

Browse Popular Code Answers by Language