HHH-9215 HHH-9214 HHH-9213 correcting Sybase test failures
This commit is contained in:
parent
43d8751e96
commit
e520c1c2c0
|
@ -28,8 +28,10 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@Table(name="`User`")
|
||||||
public class User {
|
public class User {
|
||||||
@Id
|
@Id
|
||||||
int id;
|
int id;
|
||||||
|
|
|
@ -45,6 +45,8 @@ import org.hibernate.annotations.Generated;
|
||||||
import org.hibernate.annotations.GenerationTime;
|
import org.hibernate.annotations.GenerationTime;
|
||||||
import org.hibernate.annotations.GeneratorType;
|
import org.hibernate.annotations.GeneratorType;
|
||||||
import org.hibernate.annotations.UpdateTimestamp;
|
import org.hibernate.annotations.UpdateTimestamp;
|
||||||
|
import org.hibernate.dialect.SybaseDialect;
|
||||||
|
import org.hibernate.testing.SkipForDialect;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.hibernate.tuple.ValueGenerator;
|
import org.hibernate.tuple.ValueGenerator;
|
||||||
|
@ -57,6 +59,7 @@ import org.junit.Test;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @author Gunnar Morling
|
* @author Gunnar Morling
|
||||||
*/
|
*/
|
||||||
|
@SkipForDialect(value=SybaseDialect.class, comment="CURRENT_TIMESTAMP not supported as default value in Sybase")
|
||||||
public class DefaultGeneratedValueTest extends BaseCoreFunctionalTestCase {
|
public class DefaultGeneratedValueTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package org.hibernate.test.sql.hand.query;
|
package org.hibernate.test.sql.hand.query;
|
||||||
|
|
||||||
|
import static org.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
@ -8,7 +15,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
@ -18,8 +24,8 @@ import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.H2Dialect;
|
|
||||||
import org.hibernate.dialect.AbstractHANADialect;
|
import org.hibernate.dialect.AbstractHANADialect;
|
||||||
|
import org.hibernate.dialect.H2Dialect;
|
||||||
import org.hibernate.dialect.MySQL5Dialect;
|
import org.hibernate.dialect.MySQL5Dialect;
|
||||||
import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
|
import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
|
||||||
import org.hibernate.engine.spi.NamedSQLQueryDefinitionBuilder;
|
import org.hibernate.engine.spi.NamedSQLQueryDefinitionBuilder;
|
||||||
|
@ -46,13 +52,7 @@ import org.hibernate.type.FloatType;
|
||||||
import org.hibernate.type.LongType;
|
import org.hibernate.type.LongType;
|
||||||
import org.hibernate.type.StringType;
|
import org.hibernate.type.StringType;
|
||||||
import org.hibernate.type.TimestampType;
|
import org.hibernate.type.TimestampType;
|
||||||
|
import org.junit.Test;
|
||||||
import static org.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests of various features of native SQL queries.
|
* Tests of various features of native SQL queries.
|
||||||
|
@ -148,7 +148,7 @@ public class NativeSQLQueriesTest extends BaseCoreFunctionalTestCase {
|
||||||
{
|
{
|
||||||
final NamedSQLQueryDefinitionBuilder builder = new NamedSQLQueryDefinitionBuilder();
|
final NamedSQLQueryDefinitionBuilder builder = new NamedSQLQueryDefinitionBuilder();
|
||||||
builder.setName("namedQuery");
|
builder.setName("namedQuery");
|
||||||
builder.setQuery("select count(*) AS count from organization");
|
builder.setQuery("select count(*) AS c from organization");
|
||||||
builder.setQueryReturns(new NativeSQLQueryReturn[1]);
|
builder.setQueryReturns(new NativeSQLQueryReturn[1]);
|
||||||
|
|
||||||
sessionFactory().registerNamedSQLQueryDefinition("namedQuery", builder.createNamedQueryDefinition());
|
sessionFactory().registerNamedSQLQueryDefinition("namedQuery", builder.createNamedQueryDefinition());
|
||||||
|
@ -156,13 +156,13 @@ public class NativeSQLQueriesTest extends BaseCoreFunctionalTestCase {
|
||||||
final Session s = openSession();
|
final Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
final SQLQuery query = (SQLQuery) s.getNamedQuery("namedQuery");
|
final SQLQuery query = (SQLQuery) s.getNamedQuery("namedQuery");
|
||||||
query.addScalar("count");
|
query.addScalar("c");
|
||||||
final Object result = query.uniqueResult();
|
final Number result = (Number) query.uniqueResult();
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
s.close();
|
s.close();
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(BigInteger.valueOf(0), result);
|
assertTrue(0 == result.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue