Skip to content

Instantly share code, notes, and snippets.

@lynas
Last active November 14, 2018 17:33
Show Gist options
  • Save lynas/20d61e9b4e74155276a141a7f156bfe6 to your computer and use it in GitHub Desktop.
Save lynas/20d61e9b4e74155276a141a7f156bfe6 to your computer and use it in GitHub Desktop.
@SpringBootApplication
@EnableTransactionManagement
class HibernateStoredProcedureApplication : SpringBootServletInitializer(){
@Bean
fun sessionFactory(factory:HibernateEntityManagerFactory) = factory.sessionFactory
}
fun main(args: Array<String>) {
runApplication<HibernateStoredProcedureApplication>(*args)
}
@Service
class SampleService(val sessionFactory:SessionFactory) {
@Transactional
fun sampleMethod() {
(sessionFactory.currentSession as SessionImpl).connection().prepareCall("{call storedProcedureName()}").execute()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment