HHH-4441 : fixing out-of-specification custom Serialization (see also JBMAR-67)
git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_3@17613 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
c3a1a2c0c6
commit
1bf135296a
|
@ -1,8 +1,7 @@
|
|||
//$Id $
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
|
@ -21,20 +20,18 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
/**
|
||||
* SybaseDialect is being deprecated.
|
||||
* This dialect is being deprecated; it had been used both as the base class
|
||||
* for TransactSQL-based dialects as well as the physical dialect for handling
|
||||
* Sybase. Those functions have now been split.
|
||||
* {@link AbstractTransactSQLDialect} should be used as the base class for
|
||||
* TransactSQL-based dialects.
|
||||
*
|
||||
* AbstractTransactSQLDialect should be used as a base
|
||||
* class for Sybase and MS SQL Server dialects.
|
||||
*
|
||||
* @author Gail Badner
|
||||
* @deprecated SybaseASE15Dialect or SQLServerDialect should be
|
||||
* used instead.
|
||||
* @deprecated use {@link SybaseASE15Dialect} or {@link SQLServerDialect} instead.
|
||||
*/
|
||||
|
||||
public class SybaseDialect extends AbstractTransactSQLDialect {
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.hibernate.dialect.DB2Dialect;
|
|||
import org.hibernate.dialect.Oracle10gDialect;
|
||||
import org.hibernate.dialect.Oracle9iDialect;
|
||||
import org.hibernate.dialect.Oracle8iDialect;
|
||||
import org.hibernate.dialect.SybaseAnywhereDialect;
|
||||
|
||||
/**
|
||||
* The standard Hibernate resolver.
|
||||
|
@ -89,6 +90,10 @@ public class StandardDialectResolver extends AbstractDialectResolver{
|
|||
return new SybaseDialect();
|
||||
}
|
||||
|
||||
if ( databaseName.startsWith( "Adaptive Server Anywhere" ) ) {
|
||||
return new SybaseAnywhereDialect();
|
||||
}
|
||||
|
||||
if ( "Informix Dynamic Server".equals( databaseName ) ) {
|
||||
return new InformixDialect();
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ public final class SessionImpl extends AbstractSessionImpl
|
|||
private transient Session rootSession;
|
||||
private transient Map childSessionsByEntityMode;
|
||||
|
||||
private EntityNameResolver entityNameResolver = new CoordinatingEntityNameResolver();
|
||||
private transient EntityNameResolver entityNameResolver = new CoordinatingEntityNameResolver();
|
||||
|
||||
/**
|
||||
* Constructor used in building "child sessions".
|
||||
|
@ -1900,6 +1900,8 @@ public final class SessionImpl extends AbstractSessionImpl
|
|||
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
||||
log.trace( "deserializing session" );
|
||||
|
||||
ois.defaultReadObject();
|
||||
|
||||
entityNameResolver = new CoordinatingEntityNameResolver();
|
||||
|
||||
boolean isRootSession = ois.readBoolean();
|
||||
|
@ -1954,6 +1956,8 @@ public final class SessionImpl extends AbstractSessionImpl
|
|||
|
||||
log.trace( "serializing session" );
|
||||
|
||||
oos.defaultWriteObject();
|
||||
|
||||
oos.writeBoolean( rootSession == null );
|
||||
oos.writeObject( connectionReleaseMode.toString() );
|
||||
oos.writeObject( entityMode.toString() );
|
||||
|
|
|
@ -1897,10 +1897,22 @@ public class ASTParserLoadingTest extends FunctionalTestCase {
|
|||
hql = "from Animal a where mod(16, 4) = 4";
|
||||
session.createQuery(hql).list();
|
||||
|
||||
hql = "from Animal a where bit_length(a.bodyWeight) = 24";
|
||||
/**
|
||||
* PostgreSQL >= 8.3.7 typecasts are no longer automatically allowed
|
||||
* <link>http://www.postgresql.org/docs/current/static/release-8-3.html</link>
|
||||
*/
|
||||
if(getDialect() instanceof PostgreSQLDialect){
|
||||
hql = "from Animal a where bit_length(str(a.bodyWeight)) = 24";
|
||||
}else{
|
||||
hql = "from Animal a where bit_length(a.bodyWeight) = 24";
|
||||
}
|
||||
session.createQuery(hql).list();
|
||||
|
||||
hql = "select bit_length(a.bodyWeight) from Animal a";
|
||||
if(getDialect() instanceof PostgreSQLDialect){
|
||||
hql = "select bit_length(str(a.bodyWeight)) from Animal a";
|
||||
}else{
|
||||
hql = "select bit_length(a.bodyWeight) from Animal a";
|
||||
}
|
||||
|
||||
session.createQuery(hql).list();
|
||||
|
||||
/*hql = "select object(a) from Animal a where CURRENT_DATE = :p1 or CURRENT_TIME = :p2 or CURRENT_TIMESTAMP = :p3";
|
||||
|
|
|
@ -2130,7 +2130,7 @@ public class FooBarTest extends LegacyTestCase {
|
|||
s.find("select count(*) from Baz as baz where 1 in indices(baz.fooArray)");
|
||||
s.find("select count(*) from Bar as bar where 'abc' in elements(bar.baz.fooArray)");
|
||||
s.find("select count(*) from Bar as bar where 1 in indices(bar.baz.fooArray)");
|
||||
if ( !(getDialect() instanceof DB2Dialect) && !(getDialect() instanceof Oracle8iDialect ) && !( getDialect() instanceof SybaseDialect ) && !( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect )) {
|
||||
if ( !(getDialect() instanceof DB2Dialect) && !(getDialect() instanceof Oracle8iDialect ) && !( getDialect() instanceof SybaseDialect ) && !( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect ) && !( getDialect() instanceof PostgreSQLDialect )) {
|
||||
// SybaseAnywhereDialect supports implicit conversions from strings to ints
|
||||
s.find("select count(*) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)");
|
||||
s.find("select max( elements(bar.baz.fooArray) ) from Bar as bar, bar.component.glarch.proxyArray as g where g.id in indices(bar.baz.fooArray)");
|
||||
|
|
Loading…
Reference in New Issue