Example usage for org.hibernate.dialect Oracle10gDialect Oracle10gDialect

List of usage examples for org.hibernate.dialect Oracle10gDialect Oracle10gDialect

Introduction

In this page you can find the example usage for org.hibernate.dialect Oracle10gDialect Oracle10gDialect.

Prototype

public Oracle10gDialect() 

Source Link

Document

Constructs a Oracle10gDialect

Usage

From source file:com.isotrol.impe3.pms.core.SchemaTest.java

License:Open Source License

@Test
public void oracle() {
    showSchema(new Oracle10gDialect());
}

From source file:com.liferay.portal.spring.hibernate.DialectDetector.java

License:Open Source License

public static Dialect getDialect(DataSource dataSource) {
    String dialectKey = null;/*www. j a  v  a  2  s.c  o m*/
    Dialect dialect = null;

    Connection connection = null;

    try {
        connection = dataSource.getConnection();

        DatabaseMetaData databaseMetaData = connection.getMetaData();

        String dbName = databaseMetaData.getDatabaseProductName();
        int dbMajorVersion = databaseMetaData.getDatabaseMajorVersion();

        dialectKey = dbName.concat(StringPool.COLON).concat(String.valueOf(dbMajorVersion));

        dialect = _dialects.get(dialectKey);

        if (dialect != null) {
            return dialect;
        }

        if (_log.isInfoEnabled()) {
            _log.info("Determine dialect for " + dbName + " " + dbMajorVersion);
        }

        if (dbName.startsWith("HSQL")) {
            if (_log.isWarnEnabled()) {
                StringBundler sb = new StringBundler(6);

                sb.append("Liferay is configured to use Hypersonic as ");
                sb.append("its database. Do NOT use Hypersonic in ");
                sb.append("production. Hypersonic is an embedded ");
                sb.append("database useful for development and demo'ing ");
                sb.append("purposes. The database settings can be ");
                sb.append("changed in portal-ext.properties.");

                _log.warn(sb.toString());
            }
        }

        if (dbName.equals("ASE") && (dbMajorVersion == 15)) {
            dialect = new SybaseASE15Dialect();
        } else if (dbName.startsWith("DB2") && (dbMajorVersion == 9)) {
            dialect = new DB2Dialect();
        } else if (dbName.startsWith("Microsoft") && (dbMajorVersion == 9)) {
            dialect = new SQLServer2005Dialect();
        } else if (dbName.startsWith("Microsoft") && (dbMajorVersion == 10)) {
            dialect = new SQLServer2008Dialect();
        } else if (dbName.startsWith("Oracle") && (dbMajorVersion >= 10)) {
            dialect = new Oracle10gDialect();
        } else {
            dialect = DialectFactory.buildDialect(new Properties(), connection);
        }
    } catch (Exception e) {
        String msg = GetterUtil.getString(e.getMessage());

        if (msg.indexOf("explicitly set for database: DB2") != -1) {
            dialect = new DB2400Dialect();

            if (_log.isWarnEnabled()) {
                _log.warn("DB2400Dialect was dynamically chosen as the "
                        + "Hibernate dialect for DB2. This can be " + "overriden in portal.properties");
            }
        } else {
            _log.error(e, e);
        }
    } finally {
        DataAccess.cleanUp(connection);
    }

    if (dialect == null) {
        throw new RuntimeException("No dialect found");
    } else if (dialectKey != null) {
        if (_log.isInfoEnabled()) {
            _log.info("Found dialect " + dialect.getClass().getName());
        }

        _dialects.put(dialectKey, dialect);
    }

    return dialect;
}

From source file:com.sam.moca.server.db.translate.OracleLimitHandler.java

License:Open Source License

OracleLimitHandler() {
    // Hardcoded to use the Hibernate Oracle 10gDialect which is the newest for Hibernate
    // and is compatible for all newer versions
    _dialect = new Oracle10gDialect();
}

From source file:org.alfresco.util.schemacomp.validator.IndexColumnsValidatorTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    validator = new IndexColumnsValidator();
    validationResults = new Results();
    ctx = new DiffContext(new Oracle10gDialect(), validationResults, null, null);
}

From source file:org.alfresco.util.schemacomp.validator.NameValidatorTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    validator = new NameValidator();
    validationResults = new Results();
    ctx = new DiffContext(new Oracle10gDialect(), validationResults, null, null);
}

From source file:org.beangle.orm.hibernate.tool.HbmGenerator.java

License:Open Source License

@SuppressWarnings("unchecked")
public void gen(String file) throws Exception {
    hbconfig = new OverrideConfiguration();
    hbconfig.getProperties().put(Environment.DIALECT, new Oracle10gDialect());
    ConfigBuilder.build(hbconfig);/*from w w  w.  j  a va  2s . c om*/
    freemarkerConfig = new freemarker.template.Configuration();
    freemarkerConfig.setTemplateLoader(new ClassTemplateLoader(getClass(), "/"));

    Iterator<PersistentClass> iter = hbconfig.getClassMappings();
    List<PersistentClass> pcs = CollectUtils.newArrayList();
    while (iter.hasNext()) {
        PersistentClass pc = iter.next();
        Class<?> cls = pc.getMappedClass();
        Iterator<Property> pi = pc.getPropertyIterator();
        // For AnnotationBinder don't set column'length and nullable in ,let's we do it.
        while (pi.hasNext()) {
            Property p = pi.next();
            if (p.getColumnSpan() != 1)
                continue;
            Column column = (Column) p.getColumnIterator().next();
            if (column.getLength() == Column.DEFAULT_LENGTH) {
                Size size = findAnnotation(cls, Size.class, p.getName());
                if (null != size)
                    column.setLength(size.max());
            }
            if (column.isNullable()) {
                NotNull notnull = findAnnotation(cls, NotNull.class, p.getName());
                if (null != notnull)
                    column.setNullable(false);
            }
        }
        if (!pc.getClassName().contains(".example."))
            pcs.add(pc);
    }
    Map<String, Object> data = CollectUtils.newHashMap();
    data.put("classes", pcs);
    data.put("generator", this);
    Template freemarkerTemplate = freemarkerConfig.getTemplate("/hbm.ftl");
    FileWriter fw = new FileWriter("/tmp/hibernate.hbm.xml");
    freemarkerTemplate.process(data, fw);
}