org.hibernate.dialect.Oracle8iDialect Java Examples

The following examples show how to use org.hibernate.dialect.Oracle8iDialect. 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: EngineDecorator.java    From jpa2ddl with Apache License 2.0 5 votes vote down vote up
public static EngineDecorator getEngineDecorator(String dialect) throws ClassNotFoundException {
	Class<?> dialectClass = Class.forName(dialect);
	if (MySQLDialect.class.isAssignableFrom(dialectClass)) {
		return new MySQLDecorator();
	} else if (PostgreSQL81Dialect.class.isAssignableFrom(dialectClass)) {
		return new PostgreSQLDecorator();
	} else if (Oracle8iDialect.class.isAssignableFrom(dialectClass)) {
		return new OracleDecorator();
	} else if (SQLServerDialect.class.isAssignableFrom(dialectClass)) {
		return new SQLServerDecorator();
	}
	return new NoOpDecorator();

}
 
Example #2
Source File: ASTParserLoadingTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testStr() {
	Session session = openSession();
	Transaction txn = session.beginTransaction();
	Animal an = new Animal();
	an.setBodyWeight(123.45f);
	session.persist(an);
	String str = (String) session.createQuery("select str(an.bodyWeight) from Animal an where str(an.bodyWeight) like '123%' or str(an.bodyWeight) like '1.23%'").uniqueResult();
	if ( getDialect() instanceof DB2Dialect ) {
		assertTrue( str.startsWith("1.234") );
	}
	else if ( getDialect() instanceof SQLServerDialect ) {
		// no assertion as SQLServer always returns nulls here; even trying directly against the
		// database, it seems to have problems with str() in the where clause...
	}
	else {
		assertTrue( str.startsWith("123.4") );
	}
	if ( ! ( getDialect() instanceof SybaseDialect ) ) {
		// In TransactSQL (the variant spoken by Sybase and SQLServer), the str() function
		// is explicitly intended for numeric values only...
		String dateStr1 = (String) session.createQuery("select str(current_date) from Animal").uniqueResult();
		String dateStr2 = (String) session.createQuery("select str(year(current_date))||'-'||str(month(current_date))||'-'||str(day(current_date)) from Animal").uniqueResult();
		System.out.println(dateStr1 + '=' + dateStr2);
		if ( ! ( getDialect() instanceof Oracle9Dialect || getDialect() instanceof Oracle8iDialect ) ) { //Oracle renders the name of the month :(
			String[] dp1 = StringHelper.split("-", dateStr1);
			String[] dp2 = StringHelper.split("-", dateStr2);
			for (int i=0; i<3; i++) {
				if ( dp1[i].startsWith( "0" ) ) {
					dp1[i] = dp1[i].substring( 1 );
				}
				assertEquals( dp1[i], dp2[i] );
			}
		}
	}
	session.delete(an);
	txn.commit();
	session.close();
}
 
Example #3
Source File: HQLTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testGroupByFunction() {
	if ( getDialect() instanceof Oracle9Dialect ) return;
	if ( getDialect() instanceof Oracle8iDialect ) return; // the new hiearchy...
	if ( getDialect() instanceof PostgreSQLDialect ) return;
	assertTranslation( "select count(*) from Human h group by year(h.birthdate)" );
	assertTranslation( "select count(*) from Human h group by trunc( sqrt(h.bodyWeight*4)/2 )" );
	assertTranslation( "select count(*) from Human h group by year(sysdate)" );
}
 
Example #4
Source File: HQLTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testClassProperty() throws Exception {
	// This test causes failures on theta-join dialects because the SQL is different.
	// The queries are semantically the same however.
	if ( getDialect() instanceof Oracle9Dialect ) return;
	if ( getDialect() instanceof Oracle8iDialect ) return;
	assertTranslation( "from Animal a where a.mother.class = Reptile" );
}
 
Example #5
Source File: HQLTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testDuplicateImplicitJoinInSelect() {
	// This test causes failures on theta-join dialects because the SQL is different.  The old parser
	// duplicates the condition, whereas the new parser does not.  The queries are semantically the
	// same however.
	if ( getDialect() instanceof Oracle9Dialect ) return;
	if ( getDialect() instanceof Oracle8iDialect ) return;
	assertTranslation( "select an.mother.bodyWeight from Animal an join an.mother m where an.mother.bodyWeight > 10" );
	assertTranslation( "select an.mother.bodyWeight from Animal an where an.mother.bodyWeight > 10" );
	//assertTranslation("select an.mother from Animal an where an.mother.bodyWeight is not null");
	assertTranslation( "select an.mother.bodyWeight from Animal an order by an.mother.bodyWeight" );
}
 
Example #6
Source File: StrategySelectorBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private void addDialects(StrategySelectorImpl strategySelector) {
	addDialect( strategySelector, Cache71Dialect.class );
	addDialect( strategySelector, CUBRIDDialect.class );
	addDialect( strategySelector, DB2Dialect.class );
	addDialect( strategySelector, DB2390Dialect.class );
	addDialect( strategySelector, DB2390V8Dialect.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, HANAColumnStoreDialect.class );
	addDialect( strategySelector, HANARowStoreDialect.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, MySQL57InnoDBDialect.class );
	addDialect( strategySelector, MySQL57Dialect.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 );
}
 
Example #7
Source File: HibernateUtil.java    From unitime with Apache License 2.0 4 votes vote down vote up
public static boolean isOracle() {
	return Oracle8iDialect.class.isAssignableFrom(getDialect());
}
 
Example #8
Source File: RepositoryIOTest.java    From MogwaiERDesignerNG with GNU General Public License v3.0 3 votes vote down vote up
public void testLoadSaveRepository() throws Exception {

		Connection theConnection = createConnection();

		Class theHibernateDialect = Oracle8iDialect.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));
	}