private String resolveToLiteralString(Type type) { try { LiteralType literalType = (LiteralType) type; Dialect dialect = factory.getDialect(); return literalType.objectToSQLString(constantValue, dialect); } catch (Throwable t) { throw new QueryException(QueryTranslator.ERROR_CANNOT_FORMAT_LITERAL + constantExpression, t); } }
protected String generateLockString() { SessionFactoryImplementor factory = lockable.getFactory(); Update update = new Update(factory.getDialect()); update.setTableName(lockable.getRootTableName()); update.addPrimaryKeyColumns(lockable.getRootTableIdentifierColumnNames()); update.setVersionColumnName(lockable.getVersionColumnName()); update.addColumn(lockable.getVersionColumnName()); if (factory.getSettings().isCommentsEnabled()) { update.setComment(lockMode + " lock " + lockable.getEntityName()); } return update.toStatementString(); }
public OneToManyPersister( Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException { super(collection, cacheAccessStrategy, cfg, factory); cascadeDeleteEnabled = collection.getKey().isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete(); keyIsNullable = collection.getKey().isNullable(); keyIsUpdateable = collection.getKey().isUpdateable(); }
protected String generateLockString() { SessionFactoryImplementor factory = lockable.getFactory(); SimpleSelect select = new SimpleSelect(factory.getDialect()) .setLockMode(lockMode) .setTableName(lockable.getRootTableName()) .addColumn(lockable.getRootTableIdentifierColumnNames()[0]) .addCondition(lockable.getRootTableIdentifierColumnNames(), "=?"); if (lockable.isVersioned()) { select.addCondition(lockable.getVersionColumnName(), "=?"); } if (factory.getSettings().isCommentsEnabled()) { select.setComment(lockMode + " lock " + lockable.getEntityName()); } return select.toStatementString(); }