Java Code Examples for org.hibernate.engine.spi.SessionFactoryImplementor#getDialect()
The following examples show how to use
org.hibernate.engine.spi.SessionFactoryImplementor#getDialect() .
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: UpdateLockingStrategy.java From lams with GNU General Public License v2.0 | 5 votes |
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
Example 2
Source File: PessimisticWriteUpdateLockingStrategy.java From lams with GNU General Public License v2.0 | 5 votes |
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
Example 3
Source File: PessimisticReadUpdateLockingStrategy.java From lams with GNU General Public License v2.0 | 5 votes |
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
Example 4
Source File: HibernateUtil.java From unitime with Apache License 2.0 | 5 votes |
public static void addBitwiseOperationsToDialect() { SessionFactoryImplementor hibSessionFactory = (SessionFactoryImplementor)new _RootDAO().getSession().getSessionFactory(); Dialect dialect = hibSessionFactory.getDialect(); if (!dialect.getFunctions().containsKey("bit_and")) { if (isOracle()) dialect.getFunctions().put("bit_and", new StandardSQLFunction("bitand", IntegerType.INSTANCE)); else if (isPostgress()) dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "cast(?1 as int) & cast(?2 as int)")); else dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "?1 & ?2")); } }
Example 5
Source File: HibernateUtil.java From unitime with Apache License 2.0 | 5 votes |
public static void addAddDateToDialect() { SessionFactoryImplementor hibSessionFactory = (SessionFactoryImplementor)new _RootDAO().getSession().getSessionFactory(); Dialect dialect = hibSessionFactory.getDialect(); if (isPostgress() && !dialect.getFunctions().containsKey("adddate")) { dialect.getFunctions().put("adddate", new SQLFunctionTemplate(IntegerType.INSTANCE, "?1 + (?2) * interval '1 day'")); } }
Example 6
Source File: JaversSqlAutoConfiguration.java From javers with Apache License 2.0 | 5 votes |
@Bean public DialectName javersSqlDialectName() { SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) entityManagerFactory.unwrap(SessionFactory.class); Dialect hibernateDialect = sessionFactory.getDialect(); logger.info("detected Hibernate dialect: " + hibernateDialect.getClass().getSimpleName()); return dialectMapper.map(hibernateDialect); }