本文整理汇总了Java中org.hibernate.dialect.DB2Dialect类的典型用法代码示例。如果您正苦于以下问题:Java DB2Dialect类的具体用法?Java DB2Dialect怎么用?Java DB2Dialect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DB2Dialect类属于org.hibernate.dialect包,在下文中一共展示了DB2Dialect类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: determineDatabaseDialectClass
import org.hibernate.dialect.DB2Dialect; //导入依赖的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.DB2Dialect; //导入依赖的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: determineDatabaseDialectClass
import org.hibernate.dialect.DB2Dialect; //导入依赖的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
示例4: shouldTestBeSkippedForCurrentDB
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
private boolean shouldTestBeSkippedForCurrentDB()
{
Dialect dialect = (Dialect) applicationContext.getBean("dialect");
return dialect instanceof AlfrescoOracle9Dialect
|| dialect instanceof AlfrescoSQLServerDialect
|| dialect instanceof DB2Dialect;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:ThumbnailServiceImplTest.java
示例5: testLargeStrings
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
public void testLargeStrings() throws Exception
{
StringBuilder sb = new StringBuilder(2056);
for (int i = 0; i < 1024; i++)
{
if (dialect instanceof DB2Dialect)
{
sb.append("A"); // pending ALF-4300
}
else
{
sb.append("\u1234");
}
}
String longString = sb.toString();
int len = longString.length();
// Create a normal node
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(5);
// fill properties
fillProperties(TYPE_QNAME_TEST_CONTENT, properties);
fillProperties(ASPECT_QNAME_TEST_TITLED, properties);
// create node for real
NodeRef nodeRef = nodeService.createNode(
rootNodeRef,
ASSOC_TYPE_QNAME_TEST_CHILDREN,
QName.createQName("MyContent"),
TYPE_QNAME_TEST_CONTENT,
properties).getChildRef();
// Modify name using the long string
nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, longString);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:BaseNodeServiceTest.java
示例6: testStr
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
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();
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:39,代码来源:ASTParserLoadingTest.java
示例7: testCast
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
public void testCast() {
if ( ( getDialect() instanceof MySQLDialect ) || ( getDialect() instanceof DB2Dialect ) ) {
return;
}
Session session = openSession();
Transaction txn = session.beginTransaction();
session.createQuery("from Human h where h.nickName like 'G%'").list();
session.createQuery("from Animal a where cast(a.bodyWeight as string) like '1.%'").list();
session.createQuery("from Animal a where cast(a.bodyWeight as integer) = 1").list();
txn.commit();
session.close();
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:13,代码来源:ASTParserLoadingTest.java
示例8: testExtract
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
public void testExtract() {
Session session = openSession();
Transaction txn = session.beginTransaction();
session.createQuery("select second(current_timestamp()), minute(current_timestamp()), hour(current_timestamp()) from Mammal m").list();
session.createQuery("select day(m.birthdate), month(m.birthdate), year(m.birthdate) from Mammal m").list();
if ( !(getDialect() instanceof DB2Dialect) ) { //no ANSI extract
session.createQuery("select extract(second from current_timestamp()), extract(minute from current_timestamp()), extract(hour from current_timestamp()) from Mammal m").list();
session.createQuery("select extract(day from m.birthdate), extract(month from m.birthdate), extract(year from m.birthdate) from Mammal m").list();
}
txn.commit();
session.close();
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:13,代码来源:ASTParserLoadingTest.java
示例9: testOrderBy
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
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)" );
}
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:13,代码来源:HQLTest.java
示例10: determineDatabaseDialectClass
import org.hibernate.dialect.DB2Dialect; //导入依赖的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<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;
}
}
开发者ID:aapotts,项目名称:kuali_rice,代码行数:19,代码来源:DevHibernateJpaVendorAdapter.java
示例11: addDialects
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
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 );
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:StrategySelectorBuilder.java
示例12: testQueryLockMode
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
public void testQueryLockMode() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
Bar bar = new Bar();
s.save(bar);
s.flush();
bar.setString("changed");
Baz baz = new Baz();
baz.setFoo(bar);
s.save(baz);
Query q = s.createQuery("from Foo foo, Bar bar");
if ( !(getDialect() instanceof DB2Dialect) ) {
q.setLockMode("bar", LockMode.UPGRADE);
}
Object[] result = (Object[]) q.uniqueResult();
Object b = result[0];
assertTrue( s.getCurrentLockMode(b)==LockMode.WRITE && s.getCurrentLockMode( result[1] )==LockMode.WRITE );
tx.commit();
s.disconnect();
s.reconnect();
tx = s.beginTransaction();
assertTrue( s.getCurrentLockMode(b)==LockMode.NONE );
s.find("from Foo foo");
assertTrue( s.getCurrentLockMode(b)==LockMode.NONE );
q = s.createQuery("from Foo foo");
q.setLockMode("foo", LockMode.READ);
q.list();
assertTrue( s.getCurrentLockMode(b)==LockMode.READ);
s.evict(baz);
tx.commit();
s.disconnect();
s.reconnect();
tx = s.beginTransaction();
assertTrue( s.getCurrentLockMode(b)==LockMode.NONE );
s.delete( s.load( Baz.class, baz.getCode() ) );
assertTrue( s.getCurrentLockMode(b)==LockMode.NONE );
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
q = s.createQuery("from Foo foo, Bar bar, Bar bar2");
if ( !(getDialect() instanceof DB2Dialect) ) {
q.setLockMode("bar", LockMode.UPGRADE);
}
q.setLockMode("bar2", LockMode.READ);
result = (Object[]) q.list().get(0);
if ( !(getDialect() instanceof DB2Dialect) ) {
assertTrue( s.getCurrentLockMode( result[0] )==LockMode.UPGRADE && s.getCurrentLockMode( result[1] )==LockMode.UPGRADE );
}
s.delete( result[0] );
tx.commit();
s.close();
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:58,代码来源:FooBarTest.java
示例13: testScrollableIterator
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
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();
}
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:70,代码来源:FooBarTest.java
示例14: appliesTo
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
public boolean appliesTo(Dialect dialect) {
return ( dialect instanceof DB2Dialect);
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:4,代码来源:DB2CustomSQLTest.java
示例15: IbmDb2DatabasePlatform
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
public IbmDb2DatabasePlatform() {
super(new DB2Dialect(), "jdbc:db2://<host>[:<port>]/<database_name>");
}
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:4,代码来源:IbmDb2DatabasePlatform.java
示例16: allowsPhysicalColumnNameInOrderby
import org.hibernate.dialect.DB2Dialect; //导入依赖的package包/类
/**
* Does the db/dialect support using a column's physical name in the order-by clause
* even after it has been aliased in the select clause. This is not actually
* required by the SQL spec, although virtually ever DB in the world supports this
* (the most glaring omission here being IBM-variant DBs ala DB2 and Derby).
*
* @param testDescription description of the scenario being tested.
* @return true if is allowed
*/
protected boolean allowsPhysicalColumnNameInOrderby(String testDescription) {
if ( DB2Dialect.class.isInstance( getDialect() ) ) {
// https://issues.apache.org/jira/browse/DERBY-1624
reportSkip( "Dialect does not support physical column name in order-by clause after it is aliased", testDescription );
return false;
}
return true;
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:18,代码来源:FunctionalTestCase.java
注:本文中的org.hibernate.dialect.DB2Dialect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论