Java Code Examples for org.hibernate.engine.spi.SessionImplementor#connection()
The following examples show how to use
org.hibernate.engine.spi.SessionImplementor#connection() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiTenancyDemo.java From HibernateDemos with The Unlicense | 5 votes |
private static void createTable(String tenantId) { // Multi-tenancy does not currently support schema export, so manually create it here. try { final Session s = openSession( tenantId ); final SessionImplementor sImpl = (SessionImplementor) s; final Connection conn = sImpl.connection(); final Statement stmt = conn.createStatement(); stmt.executeUpdate( "CREATE TABLE Project (id bigint generated by default as identity, name varchar(255), primary key (id))" ); stmt.close(); s.close(); } catch (Exception e) { e.printStackTrace(); } }
Example 2
Source File: MultiTenancyDemo.java From hibernate-demos with Apache License 2.0 | 5 votes |
private static void createTable(String tenantId) { // Multi-tenancy does not currently support schema export, so manually create it here. try { final Session s = openSession( tenantId ); final SessionImplementor sImpl = (SessionImplementor) s; final Connection conn = sImpl.connection(); final Statement stmt = conn.createStatement(); stmt.executeUpdate( "CREATE TABLE Project (id bigint generated by default as identity, name varchar(255), primary key (id))" ); stmt.close(); s.close(); } catch (Exception e) { e.printStackTrace(); } }
Example 3
Source File: SpringHibernateTransactionOperations.java From micronaut-data with Apache License 2.0 | 4 votes |
@NonNull @Override public Connection getConnection() { final SessionImplementor session = (SessionImplementor) sessionFactory.getCurrentSession(); return session.connection(); }
Example 4
Source File: SpringHibernateTransactionOperations.java From micronaut-data with Apache License 2.0 | 4 votes |
@NonNull @Override public Connection getConnection() { final SessionImplementor session = (SessionImplementor) sessionFactory.getCurrentSession(); return session.connection(); }