当前位置: 首页>>代码示例>>Java>>正文


Java FormatStyle类代码示例

本文整理汇总了Java中org.hibernate.engine.jdbc.internal.FormatStyle的典型用法代码示例。如果您正苦于以下问题:Java FormatStyle类的具体用法?Java FormatStyle怎么用?Java FormatStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FormatStyle类属于org.hibernate.engine.jdbc.internal包,在下文中一共展示了FormatStyle类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SchemaExport

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
public SchemaExport(ServiceRegistry serviceRegistry, Configuration configuration) {
	this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
			serviceRegistry.getService( ConnectionProvider.class )
	);
	this.sqlStatementLogger = serviceRegistry.getService( JdbcServices.class ).getSqlStatementLogger();
	this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
	this.sqlExceptionHelper = serviceRegistry.getService( JdbcServices.class ).getSqlExceptionHelper();

	this.importFiles = ConfigurationHelper.getString(
			AvailableSettings.HBM2DDL_IMPORT_FILES,
			configuration.getProperties(),
			DEFAULT_IMPORT_FILE
	);

	final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect();
	this.dropSQL = configuration.generateDropSchemaScript( dialect );
	this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:SchemaExport.java

示例2: insert

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
/**
 * Makes insert of last value of identifier
 * 
 * @param connection
 * @param value
 * @throws SQLException
 */
private void insert(Connection connection, IntegralDataTypeHolder value)
	throws SQLException {

    PreparedStatement insertPS = null;
    try {
	statementLogger.logStatement(insertQuery,
		FormatStyle.BASIC.getFormatter());
	insertPS = connection.prepareStatement(insertQuery);
	insertPS.setString(FIRST_COLUMN, segmentValue);
	value.bind(insertPS, SECOND_COLUMN);
	insertPS.execute();
    } finally {
	close(insertPS);
    }
}
 
开发者ID:levants,项目名称:lightmare,代码行数:23,代码来源:TableGeneratorExt.java

示例3: execute

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
@Override
public IntegralDataTypeHolder execute(Connection connection)
	throws SQLException {
    IntegralDataTypeHolder value = IdentifierGeneratorHelper
	    .getIntegralDataTypeHolder(identifierType
		    .getReturnedClass());
    int rows;
    do {
	statementLogger.logStatement(selectQuery,
		FormatStyle.BASIC.getFormatter());
	onSelect(connection, value);
	statementLogger.logStatement(updateQuery,
		FormatStyle.BASIC.getFormatter());
	rows = onUpdate(connection, value);
    } while (rows == ZERO_ROWS);

    return value;
}
 
开发者ID:levants,项目名称:lightmare,代码行数:19,代码来源:TableGeneratorExt.java

示例4: SchemaUpdate

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
public SchemaUpdate(Configuration configuration, Properties properties) throws HibernateException {
	this.configuration = configuration;
	this.dialect = Dialect.getDialect( properties );

	Properties props = new Properties();
	props.putAll( dialect.getDefaultProperties() );
	props.putAll( properties );
	this.connectionHelper = new ManagedProviderConnectionHelper( props );

	this.sqlExceptionHelper = new SqlExceptionHelper();
	this.sqlStatementLogger = new SqlStatementLogger( false, true );
	this.formatter = FormatStyle.DDL.getFormatter();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:SchemaUpdate.java

示例5: prepareStatement

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
private PreparedStatement prepareStatement(
		Connection connection,
		String sql,
		SqlStatementLogger statementLogger,
		SessionEventListenerManager statsCollector) throws SQLException {
	statementLogger.logStatement( sql, FormatStyle.BASIC.getFormatter() );
	try {
		statsCollector.jdbcPrepareStatementStart();
		return connection.prepareStatement( sql );
	}
	finally {
		statsCollector.jdbcPrepareStatementEnd();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:TableGenerator.java

示例6: main

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
public static void main(String[] args) {
	boolean drop = false;
	boolean create = false;
	String outFile = null;
	String delimiter = "";
	String persistenceUnitName = null;

	for (int i = 0; i < args.length; i++) {
		if (args[i].startsWith("--")) {
			if (args[i].equals("--drop")) {
				drop = true;
			} else if (args[i].equals("--create")) {
				create = true;
			} else if (args[i].startsWith("--output=")) {
				outFile = args[i].substring(9);
			} else if (args[i].startsWith("--delimiter=")) {
				delimiter = args[i].substring(12);
			} else if (args[i].startsWith("--persistenceUnitName=")){
				persistenceUnitName = args[i].substring(22);
			}
		}
	}

	Formatter formatter = FormatStyle.DDL.getFormatter();

	Ejb3Configuration jpaConfiguration = new Ejb3Configuration().configure(
			persistenceUnitName, null);
	
	SchemaExporter.export(jpaConfiguration, drop, create, outFile, delimiter, formatter);
}
 
开发者ID:tlin-fei,项目名称:ds4p,代码行数:31,代码来源:PersistenceXmlConfigSchemaExporter.java

示例7: DbOpenHelper

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
public DbOpenHelper(ServiceRegistry serviceRegistry) throws HibernateException {
    final JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    connectionHelper = new SuppliedConnectionProviderConnectionHelper(jdbcServices.getConnectionProvider());

    sqlStatementLogger = jdbcServices.getSqlStatementLogger();
    formatter = (sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE).getFormatter();
}
 
开发者ID:sismics,项目名称:books,代码行数:8,代码来源:DbOpenHelper.java

示例8: setFormat

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
public void setFormat(boolean format) {
	this.formatter = ( format ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:SchemaUpdate.java

示例9: main

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
public static void main(String[] args) {
	boolean drop = false;
	boolean create = false;
	String outFile = null;
	String delimiter = "";
	String activeSpringProfile = null;
	String dataAccessApplicationContextConfigClassPath = null;

	for (int i = 0; i < args.length; i++) {
		if (args[i].startsWith("--")) {
			if (args[i].equals("--drop")) {
				drop = true;
			} else if (args[i].equals("--create")) {
				create = true;
			} else if (args[i].startsWith("--output=")) {
				outFile = args[i].substring(9);
			} else if (args[i].startsWith("--delimiter=")) {
				delimiter = args[i].substring(12);
			} else if (args[i].startsWith("--activeSpringProfile=")) {
				activeSpringProfile = args[i].substring(22);
			} else if (args[i].startsWith("--dataAccessApplicationContextConfigClassPath=")) {
				dataAccessApplicationContextConfigClassPath = args[i].substring(46);
			}
			
		}
	}

	Formatter formatter = FormatStyle.DDL.getFormatter();

	GenericXmlApplicationContext context = new GenericXmlApplicationContext();
	if (activeSpringProfile != null) {
		context.getEnvironment().setActiveProfiles(activeSpringProfile);
	}
	
	context.load(dataAccessApplicationContextConfigClassPath);

	context.refresh();

	AbstractEntityManagerFactoryBean bean = context
			.getBean(AbstractEntityManagerFactoryBean.class);

	Ejb3Configuration jpaConfiguration = new Ejb3Configuration().configure(
			bean.getPersistenceUnitInfo(), bean.getJpaPropertyMap());

	SchemaExporter.export(jpaConfiguration, drop, create, outFile, delimiter, formatter);

	context.close();
}
 
开发者ID:tlin-fei,项目名称:ds4p,代码行数:49,代码来源:SpringEntityManagerFactoryBeanConfigSchemaExporter.java

示例10: setFormat

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
/**
 * Should we format the sql strings?
 *
 * @param format Should we format SQL strings
 * @return this
 */
public SchemaExport setFormat(boolean format) {
	this.formatter = ( format ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
	return this;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:SchemaExport.java

示例11: logStatement

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
/**
 * Log a SQL statement string.
 *
 * @param statement The SQL statement.
 */
public void logStatement(String statement) {
	// for now just assume a DML log for formatting
	logStatement( statement, FormatStyle.BASIC.getFormatter() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:SqlStatementLogger.java

示例12: setFormat

import org.hibernate.engine.jdbc.internal.FormatStyle; //导入依赖的package包/类
/**
 * Format the output SQL statements.
 * 
 * @param format True to format
 */
public void setFormat(boolean format) {
    this.formatter = (format ? FormatStyle.DDL : FormatStyle.NONE).getFormatter();
}
 
开发者ID:sismics,项目名称:books,代码行数:9,代码来源:DbOpenHelper.java


注:本文中的org.hibernate.engine.jdbc.internal.FormatStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。