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


Java HSQLDialect类代码示例

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


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

示例1: determineDatabaseDialectClass

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
/**
 * Determine the Hibernate database dialect class for the given target database.
 * @param database the target database
 * @return the Hibernate database dialect class, or {@code null} if none found
 */
@SuppressWarnings("deprecation")
protected Class<?> determineDatabaseDialectClass(Database database) {
	switch (database) {
		case DB2: return DB2Dialect.class;
		case DERBY: return DerbyDialect.class;  // DerbyDialect deprecated in 4.x
		case H2: return H2Dialect.class;
		case HSQL: return HSQLDialect.class;
		case INFORMIX: return InformixDialect.class;
		case MYSQL: return MySQLDialect.class;
		case ORACLE: return Oracle9iDialect.class;
		case POSTGRESQL: return PostgreSQLDialect.class;  // PostgreSQLDialect deprecated in 4.x
		case SQL_SERVER: return SQLServerDialect.class;
		case SYBASE: return org.hibernate.dialect.SybaseDialect.class;  // SybaseDialect deprecated in 3.6 but not 4.x
		default: return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:HibernateJpaVendorAdapter.java

示例2: hibernateDatabaseDialectClass

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
private static Class<?> hibernateDatabaseDialectClass(DatabasePlatform database) {
	switch (database) {
	case DB2:
		return DB2Dialect.class;
	case DB2_AS400:
		return DB2400Dialect.class;
	case DERBY:
		return DerbyTenSevenDialect.class;
	case H2:
		return H2Dialect.class;
	case HSQL:
		return HSQLDialect.class;
	case INFORMIX:
		return InformixDialect.class;
	case MYSQL:
		return MySQL5Dialect.class;
	case ORACLE:
		return Oracle10gDialect.class;
	case POSTGRESQL:
		return PostgreSQL82Dialect.class;
	case SQL_SERVER:
		return SQLServerDialect.class;
	case MARIADB:
		return MySQL5Dialect.class;
	case HANA:
		return HANARowStoreDialect.class;
	case SQLITE:
	case NONE:
	default:
		break;
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa,代码行数:34,代码来源:EntityManagerFactoryConfigurator.java

示例3: testManyToManyBag

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void testManyToManyBag() throws Exception {

		Session s = openSession();
		Baz baz = new Baz();
		Serializable id = s.save(baz);
		s.flush();
		s.connection().commit();
		s.close();

		s = openSession();
		baz = (Baz) s.load(Baz.class, id);
		baz.getFooBag().add( new Foo() );
		s.flush();
		s.connection().commit();
		s.close();

		s = openSession();
		baz = (Baz) s.load(Baz.class, id);
		assertTrue( !Hibernate.isInitialized( baz.getFooBag() ) );
		assertTrue( baz.getFooBag().size()==1 );
		if ( !(getDialect() instanceof HSQLDialect) ) assertTrue( Hibernate.isInitialized( baz.getFooBag().iterator().next() ) );
		s.delete(baz);
		s.flush();
		s.connection().commit();
		s.close();
	}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:27,代码来源:FooBarTest.java

示例4: testSelfManyToOne

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void testSelfManyToOne() throws Exception {

		//if (dialect instanceof HSQLDialect) return;

		Session s = openSession();
		Transaction t = s.beginTransaction();
		Master m = new Master();
		m.setOtherMaster(m);
		s.save(m);
		t.commit();
		s.close();
		s = openSession();
		t = s.beginTransaction();
		Iterator i = s.iterate("from Master");
		m = (Master) i.next();
		assertTrue( m.getOtherMaster()==m );
		if (getDialect() instanceof HSQLDialect) { m.setOtherMaster(null); s.flush(); }
		s.delete(m);
		t.commit();
		s.close();
	}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:MasterDetailTest.java

示例5: testExpressionWithParamInFunction

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
/**
 * Copied from {@link HQLTest#testExpressionWithParamInFunction}
 */
public void testExpressionWithParamInFunction() {
	Session s = openSession();
	s.beginTransaction();
	s.createQuery( "from Animal a where abs(a.bodyWeight-:param) < 2.0" ).setLong( "param", 1 ).list();
	s.createQuery( "from Animal a where abs(:param - a.bodyWeight) < 2.0" ).setLong( "param", 1 ).list();
	if ( ! ( getDialect() instanceof HSQLDialect ) ) {
		// HSQLDB does not like the abs(? - ?) syntax...
		s.createQuery( "from Animal where abs(:x - :y) < 2.0" ).setLong( "x", 1 ).setLong( "y", 1 ).list();
	}
	s.createQuery( "from Animal where lower(upper(:foo)) like 'f%'" ).setString( "foo", "foo" ).list();
	s.createQuery( "from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0" ).setLong( "param", 1 ).list();
	s.createQuery( "from Animal where lower(upper('foo') || upper(:bar)) like 'f%'" ).setString( "bar", "xyz" ).list();
	if ( ! ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof MySQLDialect ) ) {
		s.createQuery( "from Animal where abs(cast(1 as float) - cast(:param as float)) = 1.0" ).setLong( "param", 1 ).list();
	}
	s.getTransaction().commit();
	s.close();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:ASTParserLoadingTest.java

示例6: initQuickInstallConfiguration

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void initQuickInstallConfiguration()
		throws GreenPepperServerException
{
	GreenPepperServerConfiguration configuration = getConfiguration();
	
	Properties properties = new DefaultServerProperties();

	properties.put("hibernate.c3p0.acquire_increment", "1");
	properties.put("hibernate.c3p0.idle_test_period", "100");
	properties.put("hibernate.c3p0.max_size", "15");
	properties.put("hibernate.c3p0.max_statements", "0");
	properties.put("hibernate.c3p0.min_size", "0");
	properties.put("hibernate.c3p0.timeout", "30");
	properties.remove("hibernate.connection.datasource"); // direct jdbc
	properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
	properties.put("hibernate.connection.url", "jdbc:hsqldb:" + getConfluenceHome() + "/database/gpsdb");
	properties.put("hibernate.connection.username", "sa");
	properties.put("hibernate.connection.password", "");
	properties.put("hibernate.dialect", HSQLDialect.class.getName());

	configuration.setProperties(properties);

	startup(true);
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:25,代码来源:GreenPepperServerConfigurationActivator.java

示例7: initQuickInstallConfiguration

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
/**
 * <p>initQuickInstallConfiguration.</p>
 *
 * @throws com.greenpepper.server.GreenPepperServerException if any.
 */
public void initQuickInstallConfiguration() throws GreenPepperServerException {
    GreenPepperServerConfiguration configuration = getConfiguration();

    Properties properties = new DefaultServerProperties();

    properties.put("hibernate.c3p0.acquire_increment", "1");
    properties.put("hibernate.c3p0.idle_test_period", "100");
    properties.put("hibernate.c3p0.max_size", "15");
    properties.put("hibernate.c3p0.max_statements", "0");
    properties.put("hibernate.c3p0.min_size", "0");
    properties.put("hibernate.c3p0.timeout", "30");
    properties.remove("hibernate.connection.datasource"); // direct jdbc
    properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
    properties.put("hibernate.connection.url", "jdbc:hsqldb:" + getConfluenceHome() + "/database/gpsdb");
    properties.put("hibernate.connection.username", "sa");
    properties.put("hibernate.connection.password", "");
    properties.put("hibernate.dialect", HSQLDialect.class.getName());

    configuration.setProperties(properties);

    startup(true);
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:28,代码来源:GreenPepperServerConfigurationActivator.java

示例8: initQuickInstallConfiguration

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void initQuickInstallConfiguration() throws LivingDocServerException {
    LivingDocServerConfiguration customConfiguration = getConfiguration();

    Properties properties = new DefaultServerProperties();

    properties.remove("hibernate.connection.datasource"); // direct jdbc
    properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbc.JDBCDriver");
    properties.put("hibernate.connection.url", "jdbc:hsqldb:file:" + getConfluenceHome() + "/database/ldsdb");
    properties.put("hibernate.connection.username", "sa");
    properties.put("hibernate.connection.password", "");
    properties.put("hibernate.dialect", HSQLDialect.class.getName());

    configuration.setProperties(properties);

    setupDatabaseFromConfiguration(customConfiguration);
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-confluence,代码行数:17,代码来源:LivingDocServerConfigurationActivator.java

示例9: determineDatabaseDialectClass

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
/**
 * Determine the Hibernate database dialect class for the given target database.
 * @param database the target database
 * @return the Hibernate database dialect class, or {@code null} if none found
 */
protected Class determineDatabaseDialectClass(Database database) {
	switch (database) {
		case DB2: return DB2Dialect.class;
		case DERBY: return DerbyDialect.class;
		case H2: return H2Dialect.class;
		case HSQL: return HSQLDialect.class;
		case INFORMIX: return InformixDialect.class;
		case MYSQL: return MySQLDialect.class;
		case ORACLE: return Oracle9iDialect.class;
		case POSTGRESQL: return PostgreSQLDialect.class;
		case SQL_SERVER: return SQLServerDialect.class;
		case SYBASE: return SybaseDialect.class;
		default: return null;
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:21,代码来源:HibernateJpaVendorAdapter.java

示例10: HSQLHibernateEntryDatabase

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
HSQLHibernateEntryDatabase(File dataDir) {
	if (factory == null) {
		factory = new HibernateBuilder().confDriver(JDBCDriver.class).confDialect(HSQLDialect.class)
				.confConnection("jdbc:hsqldb:" + new File(dataDir, "hsqlEntryDB").getAbsolutePath())
				.buildServiceRegistry().build();
	}
	s = factory.openSession();
	createTable();
}
 
开发者ID:shilongdai,项目名称:vsDiaryWriter,代码行数:10,代码来源:HSQLHibernateEntryDatabase.java

示例11: testLoadSaveRepository

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void testLoadSaveRepository() throws
		Exception {

	Class.forName("org.hsqldb.jdbc.JDBCDriver").newInstance();
	Connection theConnection = null;
	try {
		theConnection = DriverManager.getConnection("jdbc:hsqldb:mem:dname", "sa", "");

		Class theHibernateDialect = HSQLDialect.class;

		String theModelResource = "/de/erdesignerng/test/io/repository/examplemodel.mxm";

		String theNewFile = RepositioryHelper.performRepositorySaveAndLoad(theModelResource, theHibernateDialect,
				theConnection);

		String theOriginalFile = IOUtils.toString(getClass().getResourceAsStream(theModelResource));

		assertTrue(compareStrings(theOriginalFile, theNewFile));

	} finally {
		if (theConnection != null) {

			theConnection.createStatement().execute("SHUTDOWN");
			theConnection.close();
		}
	}
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:28,代码来源:RepositoryIOTest.java

示例12: testAutoFlush

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void testAutoFlush() throws Exception {
	Session s = openSession();
	Transaction txn = s.beginTransaction();
	FooProxy foo = new Foo();
	s.save(foo);
	assertTrue( "autoflush create", s.find("from Foo foo").size()==1 );
	foo.setChar( new Character('X') );
	assertTrue( "autoflush update", s.find("from Foo foo where foo.char='X'").size()==1 );
	txn.commit();
	s.close();

	s = openSession();
	txn = s.beginTransaction();
	foo = (FooProxy) s.load( Foo.class, foo.getKey() );
	//s.update( new Foo(), foo.getKey() );
	//assertTrue( s.find("from Foo foo where not foo.char='X'").size()==1, "autoflush update" );
	if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) && !(getDialect() instanceof PointbaseDialect) )  {
		foo.setBytes( "osama".getBytes() );
		assertTrue( "autoflush collection update", s.find("from Foo foo where 111 in elements(foo.bytes)").size()==1 );
		foo.getBytes()[0] = 69;
		assertTrue( "autoflush collection update", s.find("from Foo foo where 69 in elements(foo.bytes)").size()==1 );
	}
	s.delete(foo);
	assertTrue( "autoflush delete", s.find("from Foo foo").size()==0 );
	txn.commit();
	s.close();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:28,代码来源:FooBarTest.java

示例13: testCompositeKeyPathExpressions

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void testCompositeKeyPathExpressions() throws Exception {
	Session s = openSession();
	s.find("select fum1.fo from Fum fum1 where fum1.fo.fum is not null");
	s.find("from Fum fum1 where fum1.fo.fum is not null order by fum1.fo.fum");
	if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) && !(getDialect() instanceof MckoiDialect) && !(getDialect() instanceof PointbaseDialect) ) {
		s.find("from Fum fum1 where exists elements(fum1.friends)");
		if(!(getDialect() instanceof TimesTenDialect)) { // can't execute because TimesTen can't do subqueries combined with aggreations
			s.find("from Fum fum1 where size(fum1.friends) = 0");
		}
	}
	s.find("select elements(fum1.friends) from Fum fum1");
	s.find("from Fum fum1, fr in elements( fum1.friends )");
	s.connection().commit();
	s.close();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:16,代码来源:FumTest.java

示例14: testDiscriminatorFiltering

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void testDiscriminatorFiltering() throws Exception {
	if ( ( getDialect() instanceof HSQLDialect ) ) return;
	Session s = openSession();
	Transaction t = s.beginTransaction();
	s.createQuery("from C1 c1 left join c1.c2s c2").list();
	s.createCriteria(C1.class).createCriteria("c2s").list();
	t.commit();
	s.close();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:10,代码来源:ABCProxyTest.java

示例15: testQuerySubclassAttribute

import org.hibernate.dialect.HSQLDialect; //导入依赖的package包/类
public void testQuerySubclassAttribute() {
	if ( getDialect() instanceof HSQLDialect ) {
		return; // TODO : why??
	}
	
	Session s = openSession();
	Transaction t = s.beginTransaction();
	Person p = new Person();
	p.setName("Emmanuel");
	p.setSex('M');
	s.persist(p);
	Employee q = new Employee();
	q.setName("Steve");
	q.setSex('M');
	q.setTitle("Mr");
	q.setSalary( new BigDecimal(1000) );
	s.persist(q);

	List result = s.createQuery("from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );
	
	result = s.createQuery("from Person where salary > 100 or name like 'E%'").list();
	assertEquals( result.size(), 2 );		

	result = s.createCriteria(Person.class)
		.add( Property.forName("salary").gt( new BigDecimal(100) ) )
		.list();
	assertEquals( result.size(), 1 );
	assertSame( result.get(0), q );

	result = s.createQuery("select salary from Person where salary > 100").list();
	assertEquals( result.size(), 1 );
	assertEquals( ( (BigDecimal) result.get(0) ).intValue(), 1000 );
	
	s.delete(p);
	s.delete(q);
	t.commit();
	s.close();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:41,代码来源:UnionSubclassTest.java


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