Java 类org.hibernate.dialect.HSQLDialect 实例源码

项目:lams    文件:HibernateJpaVendorAdapter.java   
/**
 * 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;
    }
}
项目:holon-datastore-jpa    文件:EntityManagerFactoryConfigurator.java   
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;
}
项目:spring4-understanding    文件:HibernateJpaVendorAdapter.java   
/**
 * 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;
    }
}
项目:cacheonix-core    文件:FooBarTest.java   
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();
    }
项目:cacheonix-core    文件:MasterDetailTest.java   
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();
    }
项目:cacheonix-core    文件:ASTParserLoadingTest.java   
/**
 * 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();
}
项目:greenpepper    文件:GreenPepperServerConfigurationActivator.java   
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);
}
项目:greenpepper    文件:GreenPepperServerConfigurationActivator.java   
/**
 * <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);
}
项目:livingdoc-confluence    文件:LivingDocServerConfigurationActivator.java   
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);
}
项目:class-guard    文件:HibernateJpaVendorAdapter.java   
/**
 * 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;
    }
}
项目:vsDiaryWriter    文件:HSQLHibernateEntryDatabase.java   
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();
}
项目:ERDesignerNG    文件:RepositoryIOTest.java   
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();
        }
    }
}
项目:cacheonix-core    文件:FooBarTest.java   
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();
}
项目:cacheonix-core    文件:FumTest.java   
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();
}
项目:cacheonix-core    文件:ABCProxyTest.java   
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();
}
项目:cacheonix-core    文件:UnionSubclassTest.java   
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();
}
项目:cacheonix-core    文件:CompositeUserTypeTest.java   
public void testCompositeUserType() {
    Session s = openSession();
    org.hibernate.Transaction t = s.beginTransaction();

    Transaction tran = new Transaction();
    tran.setDescription("a small transaction");
    tran.setValue( new MonetoryAmount( new BigDecimal(1.5), Currency.getInstance("USD") ) );
    s.persist(tran);

    List result = s.createQuery("from Transaction tran where tran.value.amount > 1.0 and tran.value.currency = 'USD'").list();
    assertEquals( result.size(), 1 );
    tran.getValue().setCurrency( Currency.getInstance("AUD") );
    result = s.createQuery("from Transaction tran where tran.value.amount > 1.0 and tran.value.currency = 'AUD'").list();
    assertEquals( result.size(), 1 );

    if ( !(getDialect() instanceof HSQLDialect) && ! (getDialect() instanceof Oracle9Dialect) ) {

        result = s.createQuery("from Transaction txn where txn.value = (1.5, 'AUD')").list();
        assertEquals( result.size(), 1 );
        result = s.createQuery("from Transaction where value = (1.5, 'AUD')").list();
        assertEquals( result.size(), 1 );

    }

    s.delete(tran);
    t.commit();
    s.close();
}
项目:cacheonix-core    文件:HQLTest.java   
public void testOrderBy() throws Exception {
    assertTranslation( "from Animal an order by an.bodyWeight" );
    assertTranslation( "from Animal an order by an.bodyWeight asc" );
    assertTranslation( "from Animal an order by an.bodyWeight desc" );
    assertTranslation( "from Animal an order by sqrt(an.bodyWeight*4)/2" );
    assertTranslation( "from Animal an order by an.mother.bodyWeight" );
    assertTranslation( "from Animal an order by an.bodyWeight, an.description" );
    assertTranslation( "from Animal an order by an.bodyWeight asc, an.description desc" );
    if ( getDialect() instanceof HSQLDialect || getDialect() instanceof DB2Dialect ) {
        assertTranslation( "from Human h order by sqrt(h.bodyWeight), year(h.birthdate)" );
    }
}
项目:cacheonix-core    文件:HQLTest.java   
public void testSelectDialectFunction() throws Exception {
    // From SQLFunctionsTest.testDialectSQLFunctions...
    if ( getDialect() instanceof HSQLDialect ) {
        assertTranslation( "select mod(s.count, 2) from org.hibernate.test.legacy.Simple as s where s.id = 10" );
        //assertTranslation( "from org.hibernate.test.legacy.Simple as s where mod(s.count, 2) = 0" );
    }
    assertTranslation( "select upper(human.name.first) from Human human" );
    assertTranslation( "from Human human where lower(human.name.first) like 'gav%'" );
    assertTranslation( "select upper(a.description) from Animal a" );
    assertTranslation( "select max(a.bodyWeight) from Animal a" );
}
项目:sakai    文件:AssignmentTestConfiguration.java   
@Bean
public Properties hibernateProperties() {
    return new Properties() {
        {
            setProperty(org.hibernate.cfg.Environment.DIALECT, environment.getProperty(org.hibernate.cfg.Environment.DIALECT, HSQLDialect.class.getName()));
            setProperty(org.hibernate.cfg.Environment.HBM2DDL_AUTO, environment.getProperty(org.hibernate.cfg.Environment.HBM2DDL_AUTO));
            setProperty(org.hibernate.cfg.Environment.ENABLE_LAZY_LOAD_NO_TRANS, environment.getProperty(org.hibernate.cfg.Environment.ENABLE_LAZY_LOAD_NO_TRANS, "true"));
            setProperty(org.hibernate.cfg.Environment.CACHE_REGION_FACTORY, environment.getProperty(org.hibernate.cfg.Environment.CACHE_REGION_FACTORY));
        }
    };
}
项目:sakai    文件:ContextMappingConfiguration.java   
@Bean
public Properties hibernateProperties() {
    return new Properties() {
        {
            setProperty(Environment.DIALECT, env.getProperty(Environment.DIALECT, HSQLDialect.class.getName()));
            setProperty(Environment.HBM2DDL_AUTO, env.getProperty(Environment.HBM2DDL_AUTO));
        }
    };
}
项目:croquet    文件:Main.java   
/**
 * This method is used to configure a {@link CroquetWicketBuilder} as we use in here an in unit tests.
 * @param clazz the settings class.
 * @param args the command line arguments.
 * @return a CroquetBuilder instance.
 * @param <S> the type of the settings.
 */
public static <S extends WicketSettings> CroquetWicketBuilder<S> configureBuilder(final Class<S> clazz, final String[] args) {
    return CroquetWicketBuilder.create(clazz, args)
        .setHomePageClass(PeoplePage.class)
        .addPageMount("/people", PeoplePage.class)
        .addPageMount("/company", CompanyPage.class)
        .addHealthCheck("/statuscheck", HealthCheck.class)
        .setSqlDialect(HSQLDialect.class)
        .addJpaEntity(PeopleBean.class)
        .addJpaEntity(CompanyBean.class)
        .setPidFile("croquet.pid");
}
项目:sakai    文件:AssignmentTestConfiguration.java   
@Bean
public Properties hibernateProperties() {
    return new Properties() {
        {
            setProperty(org.hibernate.cfg.Environment.DIALECT, environment.getProperty(org.hibernate.cfg.Environment.DIALECT, HSQLDialect.class.getName()));
            setProperty(org.hibernate.cfg.Environment.HBM2DDL_AUTO, environment.getProperty(org.hibernate.cfg.Environment.HBM2DDL_AUTO));
            setProperty(org.hibernate.cfg.Environment.ENABLE_LAZY_LOAD_NO_TRANS, environment.getProperty(org.hibernate.cfg.Environment.ENABLE_LAZY_LOAD_NO_TRANS, "true"));
            setProperty(org.hibernate.cfg.Environment.CACHE_REGION_FACTORY, environment.getProperty(org.hibernate.cfg.Environment.CACHE_REGION_FACTORY));
        }
    };
}
项目:sakai    文件:ContextMappingConfiguration.java   
@Bean
public Properties hibernateProperties() {
    return new Properties() {
        {
            setProperty(Environment.DIALECT, env.getProperty(Environment.DIALECT, HSQLDialect.class.getName()));
            setProperty(Environment.HBM2DDL_AUTO, env.getProperty(Environment.HBM2DDL_AUTO));
        }
    };
}
项目:kuali_rice    文件:DevHibernateJpaVendorAdapter.java   
/**
 * 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<code> if none found
 */
protected Class determineDatabaseDialectClass(Database database) {
    switch (database) {
        case DB2: return DB2Dialect.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 SybaseASE15Dialect.class;
        default: return null;
    }
}
项目:lams    文件:StrategySelectorBuilder.java   
private void addDialects(StrategySelectorImpl strategySelector) {
    addDialect( strategySelector, Cache71Dialect.class );
    addDialect( strategySelector, CUBRIDDialect.class );
    addDialect( strategySelector, DB2Dialect.class );
    addDialect( strategySelector, DB2390Dialect.class );
    addDialect( strategySelector, DB2400Dialect.class );
    addDialect( strategySelector, DerbyTenFiveDialect.class );
    addDialect( strategySelector, DerbyTenSixDialect.class );
    addDialect( strategySelector, DerbyTenSevenDialect.class );
    addDialect( strategySelector, FirebirdDialect.class );
    addDialect( strategySelector, FrontBaseDialect.class );
    addDialect( strategySelector, H2Dialect.class );
    addDialect( strategySelector, HSQLDialect.class );
    addDialect( strategySelector, InformixDialect.class );
    addDialect( strategySelector, IngresDialect.class );
    addDialect( strategySelector, Ingres9Dialect.class );
    addDialect( strategySelector, Ingres10Dialect.class );
    addDialect( strategySelector, InterbaseDialect.class );
    addDialect( strategySelector, JDataStoreDialect.class );
    addDialect( strategySelector, MckoiDialect.class );
    addDialect( strategySelector, MimerSQLDialect.class );
    addDialect( strategySelector, MySQL5Dialect.class );
    addDialect( strategySelector, MySQL5InnoDBDialect.class );
    addDialect( strategySelector, MySQL5Dialect.class );
    addDialect( strategySelector, MySQL5InnoDBDialect.class );
    addDialect( strategySelector, Oracle8iDialect.class );
    addDialect( strategySelector, Oracle9iDialect.class );
    addDialect( strategySelector, Oracle10gDialect.class );
    addDialect( strategySelector, PointbaseDialect.class );
    addDialect( strategySelector, PostgresPlusDialect.class );
    addDialect( strategySelector, PostgreSQL81Dialect.class );
    addDialect( strategySelector, PostgreSQL82Dialect.class );
    addDialect( strategySelector, PostgreSQL9Dialect.class );
    addDialect( strategySelector, ProgressDialect.class );
    addDialect( strategySelector, SAPDBDialect.class );
    addDialect( strategySelector, SQLServerDialect.class );
    addDialect( strategySelector, SQLServer2005Dialect.class );
    addDialect( strategySelector, SQLServer2008Dialect.class );
    addDialect( strategySelector, Sybase11Dialect.class );
    addDialect( strategySelector, SybaseAnywhereDialect.class );
    addDialect( strategySelector, SybaseASE15Dialect.class );
    addDialect( strategySelector, SybaseASE157Dialect.class );
    addDialect( strategySelector, TeradataDialect.class );
    addDialect( strategySelector, TimesTenDialect.class );
}
项目:spring4-understanding    文件:HibernateTransactionManagerTests.java   
@Test
public void testTransactionCommitWithNonExistingDatabase() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
    lsfb.setDataSource(ds);
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", HSQLDialect.class.getName());
    props.setProperty("hibernate.cache.provider_class", NoCacheProvider.class.getName());
    lsfb.setHibernateProperties(props);
    lsfb.afterPropertiesSet();
    final SessionFactory sf = lsfb.getObject();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setSessionFactory(sf);
    tm.afterPropertiesSet();
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    tt.setTimeout(10);
    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    try {
        tt.execute(new TransactionCallback() {
            @Override
            public Object doInTransaction(TransactionStatus status) {
                assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
                assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(ds));
                HibernateTemplate ht = new HibernateTemplate(sf);
                return ht.find("from java.lang.Object");
            }
        });
        fail("Should have thrown CannotCreateTransactionException");
    }
    catch (CannotCreateTransactionException ex) {
        // expected
    }

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
}
项目:spring4-understanding    文件:HibernateTransactionManagerTests.java   
@Test
public void testTransactionCommitWithPreBoundSessionAndNonExistingDatabase() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
    lsfb.setDataSource(ds);
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", HSQLDialect.class.getName());
    props.setProperty("hibernate.cache.provider_class", NoCacheProvider.class.getName());
    lsfb.setHibernateProperties(props);
    lsfb.afterPropertiesSet();
    final SessionFactory sf = lsfb.getObject();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setSessionFactory(sf);
    tm.afterPropertiesSet();
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    tt.setTimeout(10);
    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    Session session = sf.openSession();
    TransactionSynchronizationManager.bindResource(sf, new SessionHolder(session));
    try {
        tt.execute(new TransactionCallback() {
            @Override
            public Object doInTransaction(TransactionStatus status) {
                assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
                assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(ds));
                HibernateTemplate ht = new HibernateTemplate(sf);
                return ht.find("from java.lang.Object");
            }
        });
        fail("Should have thrown CannotCreateTransactionException");
    }
    catch (CannotCreateTransactionException ex) {
        // expected
        SessionHolder holder = (SessionHolder) TransactionSynchronizationManager.getResource(sf);
        assertFalse(holder.isSynchronizedWithTransaction());
    }
    finally {
        TransactionSynchronizationManager.unbindResource(sf);
        session.close();
    }

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
}
项目:spring4-understanding    文件:HibernateTransactionManagerTests.java   
@Test
public void testTransactionCommitWithNonExistingDatabaseAndLazyConnection() throws Exception {
    DriverManagerDataSource dsTarget = new DriverManagerDataSource();
    final LazyConnectionDataSourceProxy ds = new LazyConnectionDataSourceProxy();
    ds.setTargetDataSource(dsTarget);
    ds.setDefaultAutoCommit(true);
    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    //ds.setDefaultTransactionIsolationName("TRANSACTION_READ_COMMITTED");

    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
    lsfb.setDataSource(ds);
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", HSQLDialect.class.getName());
    props.setProperty("hibernate.cache.provider_class", NoCacheProvider.class.getName());
    props.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
    lsfb.setHibernateProperties(props);
    lsfb.afterPropertiesSet();
    final SessionFactory sf = lsfb.getObject();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setSessionFactory(sf);
    tm.afterPropertiesSet();
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    tt.setTimeout(10);
    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    tt.execute(new TransactionCallback() {
        @Override
        public Object doInTransaction(TransactionStatus status) {
            assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
            assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(ds));
            HibernateTemplate ht = new HibernateTemplate(sf);
            return ht.find("from java.lang.Object");
        }
    });

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
}
项目:spring4-understanding    文件:HibernateTransactionManagerTests.java   
@Test
public void testTransactionCommitWithNonExistingDatabase() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
    lsfb.setDataSource(ds);
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", HSQLDialect.class.getName());
    lsfb.setHibernateProperties(props);
    lsfb.afterPropertiesSet();
    final SessionFactory sf = lsfb.getObject();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setSessionFactory(sf);
    tm.afterPropertiesSet();
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    tt.setTimeout(10);
    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    try {
        tt.execute(new TransactionCallback() {
            @Override
            public Object doInTransaction(TransactionStatus status) {
                assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
                assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(ds));
                Session session = ((SessionHolder) TransactionSynchronizationManager.getResource(sf)).getSession();
                return session.createQuery("from java.lang.Object").list();
            }
        });
        fail("Should have thrown CannotCreateTransactionException");
    }
    catch (CannotCreateTransactionException ex) {
        // expected
    }

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
}
项目:spring4-understanding    文件:HibernateTransactionManagerTests.java   
@Test
public void testTransactionCommitWithNonExistingDatabaseAndLazyConnection() throws Exception {
    DriverManagerDataSource dsTarget = new DriverManagerDataSource();
    final LazyConnectionDataSourceProxy ds = new LazyConnectionDataSourceProxy();
    ds.setTargetDataSource(dsTarget);
    ds.setDefaultAutoCommit(true);
    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    //ds.setDefaultTransactionIsolationName("TRANSACTION_READ_COMMITTED");

    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
    lsfb.setDataSource(ds);
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", HSQLDialect.class.getName());
    props.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
    lsfb.setHibernateProperties(props);
    lsfb.afterPropertiesSet();
    final SessionFactory sf = lsfb.getObject();

    HibernateTransactionManager tm = new HibernateTransactionManager();
    tm.setSessionFactory(sf);
    tm.afterPropertiesSet();
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    tt.setTimeout(10);
    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    tt.execute(new TransactionCallback() {
        @Override
        public Object doInTransaction(TransactionStatus status) {
            assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
            assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(ds));
            Session session = ((SessionHolder) TransactionSynchronizationManager.getResource(sf)).getSession();
            return session.createQuery("from java.lang.Object").list();
        }
    });

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
}
项目:ktspring    文件:BitronixHsqlMemDbDatasourceConfig.java   
@Bean
public JPAParams hsqlJpaParams() {
    return new JPAParams("hibernate.dialect", HSQLDialect.class.getName());
}
项目:FinanceAnalytics    文件:HSQLDbDialect.java   
@Override
protected Dialect createHibernateDialect() {
  return new HSQLDialect();
}
项目:cacheonix-core    文件:FooBarTest.java   
public void testQueryCollectionOfValues() throws Exception {
    Session s = openSession();
    Baz baz = new Baz();
    baz.setDefaults();
    s.save(baz);
    Glarch g = new Glarch();
    Serializable gid = s.save(g);

    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) /*&& !(dialect instanceof MckoiDialect)*/ && !(getDialect() instanceof SAPDBDialect) && !(getDialect() instanceof PointbaseDialect) && !(getDialect() instanceof TimesTenDialect) ) {
        s.filter( baz.getFooArray(), "where size(this.bytes) > 0");
        s.filter( baz.getFooArray(), "where 0 in elements(this.bytes)");
    }
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();
    //s.find("from Baz baz where baz.fooSet.string = 'foo'");
    //s.find("from Baz baz where baz.fooArray.string = 'foo'");
    //s.find("from Baz baz where baz.fooSet.foo.string = 'foo'");
    //s.find("from Baz baz join baz.fooSet.foo foo where foo.string = 'foo'");
    s.find("from Baz baz join baz.fooSet foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.fooArray foo join foo.foo.foo foo2 where foo2.string = 'foo'");
    s.find("from Baz baz join baz.stringDateMap date where index(date) = 'foo'");
    s.find("from Baz baz join baz.topGlarchez g where index(g) = 'A'");
    s.find("select index(g) from Baz baz join baz.topGlarchez g");

    assertTrue( s.find("from Baz baz left join baz.stringSet").size()==3 );
    baz = (Baz) s.find("from Baz baz join baz.stringSet str where str='foo'").get(0);
    assertTrue( !Hibernate.isInitialized( baz.getStringSet() ) );
    baz = (Baz) s.find("from Baz baz left join fetch baz.stringSet").get(0);
    assertTrue( Hibernate.isInitialized( baz.getStringSet() ) );
    assertTrue( s.find("from Baz baz join baz.stringSet string where string='foo'").size()==1 );
    assertTrue( s.find("from Baz baz inner join baz.components comp where comp.name='foo'").size()==1 );
    //List bss = s.find("select baz, ss from Baz baz inner join baz.stringSet ss");
    s.find("from Glarch g inner join g.fooComponents comp where comp.fee is not null");
    s.find("from Glarch g inner join g.fooComponents comp join comp.fee fee where fee.count > 0");
    s.find("from Glarch g inner join g.fooComponents comp where comp.fee.count is not null");

    s.delete(baz);
    //s.delete("from Glarch g");
    s.delete( s.get(Glarch.class, gid) );
    s.flush();

    s.connection().commit();
    s.close();

}
项目:cacheonix-core    文件:FooBarTest.java   
public void testScrollableIterator() throws Exception {
    if ( getDialect() instanceof DB2Dialect || getDialect() instanceof OracleDialect || getDialect() instanceof SybaseDialect || getDialect() instanceof HSQLDialect ) {
        Session s = openSession();
        Transaction txn = s.beginTransaction();
        s.save( new Foo() );
        s.save( new Foo() );
        s.save( new Foo() );
        s.save( new Bar() );
        Query query = s.createQuery("select f, f.integer from Foo f");
        assertTrue( query.getReturnTypes().length==2 );
        ScrollableResults iter = query.scroll();
        assertTrue( iter.next() );
        assertTrue( iter.scroll(1) );
        FooProxy f2 = (FooProxy) iter.get()[0];
        assertTrue( f2!=null );
        assertTrue( iter.scroll(-1) );
        Object f1 = iter.get(0);
        iter.next();
        assertTrue( f1!=null && iter.get(0)==f2 );
        iter.getInteger(1);

        assertTrue( !iter.scroll(100) );
        assertTrue( iter.first() );
        assertTrue( iter.scroll(3) );
        Object f4 = iter.get(0);
        assertTrue( f4!=null );
        assertTrue( !iter.next() );
        assertTrue( iter.first() );
        assertTrue( iter.get(0)==f1 );
        assertTrue( iter.last() );
        assertTrue( iter.get(0)==f4 );
        assertTrue( iter.previous() );
        txn.commit();
        s.close();

        s = openSession();
        txn = s.beginTransaction();
        query = s.createQuery("select f, f.integer from Foo f");
        assertTrue( query.getReturnTypes().length==2 );
        iter = query.scroll();
        assertTrue( iter.next() );
        assertTrue( iter.scroll(1) );
        f2 = (FooProxy) iter.get()[0];
        assertTrue( f2!=null );
        assertTrue( f2.getString()!=null  && f2.getComponent().getImportantDates().length > 0 );
        assertTrue( iter.scroll(-1) );
        f1 = iter.get(0);
        iter.next();
        assertTrue( f1!=null && iter.get(0)==f2 );
        iter.getInteger(1);

        assertTrue( !iter.scroll(100) );
        assertTrue( iter.first() );
        assertTrue( iter.scroll(3) );
        f4 = iter.get(0);
        assertTrue( f4!=null );
        assertTrue( !iter.next() );
        assertTrue( iter.first() );
        assertTrue( iter.get(0)==f1 );
        assertTrue( iter.last() );
        assertTrue( iter.get(0)==f4 );
        assertTrue( iter.previous() );
        assertTrue( s.delete("from Foo")==4 );
        s.flush();
        assertTrue( s.find("from java.lang.Object").size()==0 );
        txn.commit();
        s.close();
    }
}
项目:cacheonix-core    文件:FooBarTest.java   
public void testAutoFlushCollections() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Baz baz = new Baz();
    baz.setDefaults();
    s.save(baz);
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    baz = (Baz) s.load(Baz.class, baz.getCode());
    baz.getStringArray()[0] = "bark";
    Iterator i = s.iterate("select elements(baz.stringArray) from Baz baz");
    boolean found = false;
    while ( i.hasNext() ) {
        if ( "bark".equals( i.next() ) ) found = true;
    }
    assertTrue(found);
    baz.setStringArray(null);
    i = s.iterate("select distinct elements(baz.stringArray) from Baz baz");
    assertTrue( !i.hasNext() );
    baz.setStringArray( new String[] { "foo", "bar" } );
    i = s.iterate("select elements(baz.stringArray) from Baz baz");
    assertTrue( i.hasNext() );

    Foo foo = new Foo();
    s.save(foo);
    s.flush();
    baz.setFooArray( new Foo[] {foo} );

    i = s.iterate("select foo from Baz baz join baz.fooArray foo");
    found = false;
    while ( i.hasNext() ) {
        if ( foo==i.next() ) found = true;
    }
    assertTrue(found);

    baz.getFooArray()[0] = null;
    i = s.iterate("select foo from Baz baz join baz.fooArray foo");
    assertTrue( !i.hasNext() );
    baz.getFooArray()[0] = foo;
    i = s.iterate("select elements(baz.fooArray) from Baz baz");
    assertTrue( i.hasNext() );

    if ( !(getDialect() instanceof MySQLDialect) && !(getDialect() instanceof HSQLDialect) && !(getDialect() instanceof InterbaseDialect) && !(getDialect() instanceof PointbaseDialect) && !(getDialect() instanceof SAPDBDialect) )  {
        baz.getFooArray()[0] = null;
        i = s.iterate(
            "from Baz baz where ? in elements(baz.fooArray)",
            foo, Hibernate.entity(Foo.class)
        );
        assertTrue( !i.hasNext() );
        baz.getFooArray()[0] = foo;
        i = s.iterate(
            "select foo from Foo foo where foo in "
            + "(select elt from Baz baz join baz.fooArray elt)"
        );
        assertTrue( i.hasNext() );
    }
    s.delete(foo);
    s.delete(baz);
    tx.commit();
    s.close();

}
项目:cacheonix-core    文件:IJTest.java   
public void testFormulaDiscriminator() throws Exception {
    if ( ( getDialect() instanceof OracleDialect ) || ( getDialect() instanceof HSQLDialect ) ) return;
    Session s = getSessions().openSession();
    I i = new I();
    i.setName( "i" );
    i.setType( 'a' );
    J j = new J();
    j.setName( "j" );
    j.setType( 'x' );
    j.setAmount( 1.0f );
    Serializable iid = s.save(i);
    Serializable jid = s.save(j);
    s.flush();
    s.connection().commit();
    s.close();

    getSessions().evict(I.class);

    s = getSessions().openSession();
    j = (J) s.get(I.class, jid);
    i = (I) s.get(I.class, iid);
    assertTrue( i.getClass()==I.class );
    j.setAmount( 0.5f );
    s.lock(i, LockMode.UPGRADE);
    s.flush();
    s.connection().commit();
    s.close();

    s = getSessions().openSession();
    j = (J) s.get(I.class, jid, LockMode.UPGRADE);
    i = (I) s.get(I.class, iid, LockMode.UPGRADE);
    s.flush();
    s.connection().commit();
    s.close();

    s = getSessions().openSession();
    assertTrue( s.find("from I").size()==2 );
    assertTrue( s.find("from J").size()==1 );
    assertTrue( s.find("from I i where i.class = 0").size()==1 );
    assertTrue( s.find("from I i where i.class = 1").size()==1 );
    s.connection().commit();
    s.close();

    s = getSessions().openSession();
    j = (J) s.get(J.class, jid);
    i = (I) s.get(I.class, iid);
    s.delete(j);
    s.delete(i);
    s.flush();
    s.connection().commit();
    s.close();

}
项目:cacheonix-core    文件:MasterDetailTest.java   
public void testExample() throws Exception {

        Session s = openSession();
        Transaction t = s.beginTransaction();
        Master m = new Master();
        m.setName("name");
        m.setX(5);
        m.setOtherMaster(m);
        s.save(m);
        t.commit();
        s.close();

        s = openSession();
        t = s.beginTransaction();
        Master m1 = (Master) s.createCriteria(Master.class)
            .add( Example.create(m).enableLike().ignoreCase().excludeProperty("bigDecimal") )
            .uniqueResult();
        assertTrue( m1.getOtherMaster()==m1 );
        m1 = (Master) s.createCriteria(Master.class)
            .add( Expression.eq("name", "foobar") )
            .uniqueResult();
        assertTrue( m1==null );
        m1 = (Master) s.createCriteria(Master.class)
            .add( Example.create(m).excludeProperty("bigDecimal") )
            .createCriteria("otherMaster")
                .add( Example.create(m).excludeZeroes().excludeProperty("bigDecimal") )
            .uniqueResult();
        assertTrue( m1.getOtherMaster()==m1 );
        Master m2 = (Master) s.createCriteria(Master.class)
            .add( Example.create(m).excludeNone().excludeProperty("bigDecimal") )
            .uniqueResult();
        assertTrue( m2==m1 );
        m.setName(null);
        m2 = (Master) s.createCriteria(Master.class)
            .add( Example.create(m).excludeNone().excludeProperty("bigDecimal") )
            .uniqueResult();
        assertTrue( null==m2 );
        if (getDialect() instanceof HSQLDialect) { m1.setOtherMaster(null); s.flush(); }
        s.delete(m1);
        t.commit();
        s.close();
    }
项目:cacheonix-core    文件:CustomSQLTest.java   
public void testCRUD() throws HibernateException, SQLException {

        if ( getDialect() instanceof HSQLDialect ) return;
        if ( getDialect() instanceof MySQLDialect ) return;

        Person p = new Person();

        p.setName("Max");
        p.setLastName("Andersen");
        p.setNationalID("110974XYZ�");
        p.setAddress("P. P. Street 8");

        Session s = openSession();

        s.save(p);
        s.flush();

        s.connection().commit();
        s.close();

        getSessions().evict(Person.class);
        s = openSession();

        Person p2 = (Person) s.get(Person.class, p.getId());
        assertNotSame(p, p2);
        assertEquals(p2.getId(),p.getId());
        assertEquals(p2.getLastName(),p.getLastName());
        s.flush();

        List list = s.find("select p from Party as p");
        assertTrue(list.size() == 1);

        s.connection().commit();
        s.close();

        s = openSession();

        list = s.find("select p from Person as p where p.address = 'L�rkev�nget 1'");
        assertTrue(list.size() == 0);
        p.setAddress("L�rkev�nget 1");
        s.update(p);
        list = s.find("select p from Person as p where p.address = 'L�rkev�nget 1'");
        assertTrue(list.size() == 1);
        list = s.find("select p from Party as p where p.address = 'P. P. Street 8'");
        assertTrue(list.size() == 0);

        s.delete(p);
        list = s.find("select p from Person as p");
        assertTrue(list.size() == 0);

        s.connection().commit();
        s.close();


    }
项目:cacheonix-core    文件:TestSchemaTools.java   
public boolean appliesTo(Dialect dialect) {
    return dialect instanceof HSQLDialect;
}