HHH-6773 test fails on sybase

This commit is contained in:
Strong Liu 2011-11-01 16:55:41 +08:00
parent 9509f1d8bf
commit 388ceaf186
3 changed files with 17 additions and 20 deletions

View File

@ -32,6 +32,8 @@ import org.junit.Test;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.jdbc.Work; import org.hibernate.jdbc.Work;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.descriptor.JdbcTypeNameMapper; import org.hibernate.type.descriptor.JdbcTypeNameMapper;
@ -41,6 +43,7 @@ import static org.junit.Assert.assertTrue;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class )
public class BasicOperationsTest extends BaseCoreFunctionalTestCase { public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
@Override @Override
protected Class<?>[] getAnnotatedClasses() { protected Class<?>[] getAnnotatedClasses() {

View File

@ -39,6 +39,7 @@ import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SQLServerDialect; import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.stat.Statistics; import org.hibernate.stat.Statistics;
import org.hibernate.test.annotations.A320; import org.hibernate.test.annotations.A320;
import org.hibernate.test.annotations.A320b; import org.hibernate.test.annotations.A320b;
@ -62,26 +63,16 @@ import static org.junit.Assert.fail;
public class QueryAndSQLTest extends BaseCoreFunctionalTestCase { public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@Test @Test
@SkipForDialect(value = {SQLServerDialect.class})
public void testNativeQueryWithFormulaAttribute() { public void testNativeQueryWithFormulaAttribute() {
String sql = "select t.table_name as {t.tableName}, sysdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' "; String sql,sql2;
String sql2 = "select table_name as t_name, sysdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' "; if ( getDialect() instanceof SQLServerDialect || getDialect() instanceof SybaseASE15Dialect ) {
Session s = openSession(); sql = "select t.table_name as {t.tableName}, getdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' ";
s.beginTransaction(); sql2 = "select table_name as t_name, getdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' ";
s.createSQLQuery( sql ).addEntity( "t", AllTables.class ).list(); }
s.createSQLQuery( sql2 ).setResultSetMapping( "all" ).list(); else {
SQLQuery q = s.createSQLQuery( sql2 ); sql = "select t.table_name as {t.tableName}, sysdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' ";
q.addRoot( "t", AllTables.class ).addProperty( "tableName", "t_name" ).addProperty( "daysOld", "t_time" ); sql2 = "select table_name as t_name, sysdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' ";
q.list();
s.getTransaction().commit();
s.close();
} }
@Test
@RequiresDialect(value = {SQLServerDialect.class})
public void testNativeQueryWithFormulaAttributeSqlServer() {
String sql = "select t.table_name as {t.tableName}, getdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' ";
String sql2 = "select table_name as t_name, getdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' ";
Session s = openSession(); Session s = openSession();
s.beginTransaction(); s.beginTransaction();
s.createSQLQuery( sql ).addEntity( "t", AllTables.class ).list(); s.createSQLQuery( sql ).addEntity( "t", AllTables.class ).list();

View File

@ -31,6 +31,8 @@ import org.junit.Test;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -75,6 +77,7 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect( value = SybaseASE15Dialect.class, jiraKey = "HHH-6788")
public void testCustomColumnReadAndWrite() { public void testCustomColumnReadAndWrite() {
Session s = openSession(); Session s = openSession();
org.hibernate.Transaction t = s.beginTransaction(); org.hibernate.Transaction t = s.beginTransaction();