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

View File

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

View File

@ -31,6 +31,8 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -75,6 +77,7 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase {
}
@Test
@SkipForDialect( value = SybaseASE15Dialect.class, jiraKey = "HHH-6788")
public void testCustomColumnReadAndWrite() {
Session s = openSession();
org.hibernate.Transaction t = s.beginTransaction();
@ -84,7 +87,7 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase {
f.setHoldings( new MonetoryAmount( AMOUNT, Currency.getInstance("USD") ) );
s.persist(f);
s.flush();
// Test value conversion during insert
BigDecimal amountViaSql = (BigDecimal)s.createSQLQuery("select amount_millions from MutualFund").uniqueResult();
assertEquals(AMOUNT_MILLIONS.doubleValue(), amountViaSql.doubleValue(), 0.01d);