remove some deprecated code

- OptimisticLockException
- MappingNotFoundException
- BasicQueryContract

these types were already deprecated in 5.
This commit is contained in:
gavin 2021-03-24 15:02:43 +01:00 committed by Gavin King
parent 9d6306cac2
commit af84daa416
9 changed files with 7 additions and 390 deletions

View File

@ -244,7 +244,7 @@ include::{extrasdir}/locking-optimistic-lock-type-all-update-example.sql[]
==== ====
As you can see, all the columns of the associated database row are used in the `WHERE` clause. As you can see, all the columns of the associated database row are used in the `WHERE` clause.
If any column has changed after the row was loaded, there won't be any match, and a `StaleStateException` or an `OptimisticLockException` If any column has changed after the row was loaded, there won't be any match, and a `StaleStateException` or an `OptimisticEntityLockException`
is going to be thrown. is going to be thrown.
[NOTE] [NOTE]
@ -290,7 +290,7 @@ This time, only the database column that has changed was used in the `WHERE` cla
==== ====
The main advantage of `OptimisticLockType.DIRTY` over `OptimisticLockType.ALL` The main advantage of `OptimisticLockType.DIRTY` over `OptimisticLockType.ALL`
and the default `OptimisticLockType.VERSION` used implicitly along with the `@Version` mapping, and the default `OptimisticLockType.VERSION` used implicitly along with the `@Version` mapping,
is that it allows you to minimize the risk of `OptimisticLockException` across non-overlapping entity property changes. is that it allows you to minimize the risk of `OptimisticEntityLockException` across non-overlapping entity property changes.
When using `OptimisticLockType.DIRTY`, you should also use `@DynamicUpdate` because the `UPDATE` statement must take into consideration all the dirty entity property values, When using `OptimisticLockType.DIRTY`, you should also use `@DynamicUpdate` because the `UPDATE` statement must take into consideration all the dirty entity property values,
and also the `@SelectBeforeUpdate` annotation so that detached entities are properly handled by the and also the `@SelectBeforeUpdate` annotation so that detached entities are properly handled by the

View File

@ -1025,7 +1025,7 @@ The log should be reviewed to determine if multiple representations of entities
If so, the application should be modified so there is only one representation, and a custom implementation of `org.hibernate.event.spi.EntityCopyObserver` should be provided to disallow entity copies for entities with critical data. If so, the application should be modified so there is only one representation, and a custom implementation of `org.hibernate.event.spi.EntityCopyObserver` should be provided to disallow entity copies for entities with critical data.
Using optimistic locking is recommended to detect if different representations are from different versions of the same persistent entity. Using optimistic locking is recommended to detect if different representations are from different versions of the same persistent entity.
If they are not from the same version, Hibernate will throw either the JPA `OptimisticLockException` or the native `StaleObjectStateException` depending on your bootstrapping strategy. If they are not from the same version, Hibernate will throw either the JPA `OptimisticEntityLockException` or the native `StaleObjectStateException` depending on your bootstrapping strategy.
==== ====
[[pc-contains]] [[pc-contains]]

View File

@ -74,7 +74,7 @@ https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/
[[statistics-concurrency-control]] [[statistics-concurrency-control]]
==== Concurrency Control statistics methods ==== Concurrency Control statistics methods
`getOptimisticFailureCount`:: The number of Hibernate ``StaleObjectStateException``s or JPA ``OptimisticLockException``s that occurred. `getOptimisticFailureCount`:: The number of Hibernate ``StaleObjectStateException``s or JPA ``OptimisticEntityLockException``s that occurred.
[[statistics-entity]] [[statistics-entity]]
==== Entity statistics methods ==== Entity statistics methods

View File

@ -1,238 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate;
import org.hibernate.query.CommonQueryContract;
import org.hibernate.type.Type;
/**
* Defines the aspects of query definition that apply to all forms of querying.
*
* @author Steve Ebersole
*
* @deprecated (since 5.2) use {@link CommonQueryContract} instead.
*/
@Deprecated
public interface BasicQueryContract<T extends BasicQueryContract> {
/**
* (Re)set the current FlushMode in effect for this query.
*
* @param flushMode The new FlushMode to use.
*
* @return {@code this}, for method chaining
*
* @see #getHibernateFlushMode()
*
* @deprecated (since 5.2) use {@link #setHibernateFlushMode} instead
*/
@Deprecated
default BasicQueryContract setFlushMode(FlushMode flushMode) {
setHibernateFlushMode( flushMode );
return this;
}
/**
* Obtain the FlushMode in effect for this query. By default, the query inherits the FlushMode of the Session
* from which it originates.
*
* @return The query FlushMode.
*
* @see Session#getFlushMode()
* @see FlushMode
*/
FlushMode getHibernateFlushMode();
/**
* (Re)set the current FlushMode in effect for this query.
*
* @param flushMode The new FlushMode to use.
*
* @return {@code this}, for method chaining
*
* @see #getHibernateFlushMode()
*/
T setHibernateFlushMode(FlushMode flushMode);
/**
* Obtain the CacheMode in effect for this query. By default, the query inherits the CacheMode of the Session
* from which is originates.
*
* NOTE: The CacheMode here only effects reading/writing of the query cache, not the
* entity/collection caches.
*
* @return The query CacheMode.
*
* @see Session#getCacheMode()
* @see CacheMode
*/
CacheMode getCacheMode();
/**
* (Re)set the current CacheMode in effect for this query.
*
* @param cacheMode The new CacheMode to use.
*
* @return {@code this}, for method chaining
*
* @see #getCacheMode()
*/
T setCacheMode(CacheMode cacheMode);
/**
* Are the results of this query eligible for second level query caching? This is different than second level
* caching of any returned entities and collections.
*
* NOTE: the query being "eligible" for caching does not necessarily mean its results will be cached. Second level
* query caching still has to be enabled on the {@link SessionFactory} for this to happen. Usually that is
* controlled by the {@code hibernate.cache.use_query_cache} configuration setting.
*
* @return {@code true} if the query results are eligible for caching, {@code false} otherwise.
*
* @see org.hibernate.cfg.AvailableSettings#USE_QUERY_CACHE
*/
boolean isCacheable();
/**
* Enable/disable second level query (result) caching for this query.
*
* @param cacheable Should the query results be cacheable?
*
* @return {@code this}, for method chaining
*
* @see #isCacheable
*/
T setCacheable(boolean cacheable);
/**
* Obtain the name of the second level query cache region in which query results will be stored (if they are
* cached, see the discussion on {@link #isCacheable()} for more information). {@code null} indicates that the
* default region should be used.
*
* @return The specified cache region name into which query results should be placed; {@code null} indicates
* the default region.
*/
String getCacheRegion();
/**
* Set the name of the cache region where query results should be cached (if cached at all).
*
* @param cacheRegion the name of a query cache region, or {@code null} to indicate that the default region
* should be used.
*
* @return {@code this}, for method chaining
*
* @see #getCacheRegion()
*/
T setCacheRegion(String cacheRegion);
/**
* Obtain the query timeout <b>in seconds</b>. This value is eventually passed along to the JDBC query via
* {@link java.sql.Statement#setQueryTimeout(int)}. Zero indicates no timeout.
*
* @return The timeout <b>in seconds</b>
*
* @see java.sql.Statement#getQueryTimeout()
* @see java.sql.Statement#setQueryTimeout(int)
*/
Integer getTimeout();
/**
* Set the query timeout <b>in seconds</b>.
*
* NOTE it is important to understand that any value set here is eventually passed directly through to the JDBC
* Statement which expressly disallows negative values. So negative values should be avoided as a general rule.
*
* @param timeout the timeout <b>in seconds</b>
*
* @return {@code this}, for method chaining
*
* @see #getTimeout()
*/
T setTimeout(int timeout);
/**
* Obtain the JDBC fetch size hint in effect for this query. This value is eventually passed along to the JDBC
* query via {@link java.sql.Statement#setFetchSize(int)}. As defined by JDBC, this value is a hint to the
* driver to indicate how many rows to fetch from the database when more rows are needed.
*
* NOTE : JDBC expressly defines this value as a hint. It may or may not have any effect on the actual
* query execution and ResultSet processing depending on the driver.
*
* @return The timeout <b>in seconds</b>
*
* @see java.sql.Statement#getFetchSize()
* @see java.sql.Statement#setFetchSize(int)
*/
Integer getFetchSize();
/**
* Sets a JDBC fetch size hint for the query.
*
* @param fetchSize the fetch size hint
*
* @return {@code this}, for method chaining
*
* @see #getFetchSize()
*/
T setFetchSize(int fetchSize);
/**
* Should entities and proxies loaded by this Query be put in read-only mode? If the
* read-only/modifiable setting was not initialized, then the default
* read-only/modifiable setting for the persistence context is returned instead.
*
* @see #setReadOnly(boolean)
* @see org.hibernate.engine.spi.PersistenceContext#isDefaultReadOnly()
*
* The read-only/modifiable setting has no impact on entities/proxies returned by the
* query that existed in the session before the query was executed.
*
* @return {@code true} if the entities and proxies loaded by the query will be put
* in read-only mode; {@code false} otherwise (they will be modifiable)
*/
boolean isReadOnly();
/**
* Set the read-only/modifiable mode for entities and proxies
* loaded by this Query. This setting overrides the default setting
* for the persistence context.
* @see org.hibernate.engine.spi.PersistenceContext#isDefaultReadOnly()
*
* To set the default read-only/modifiable setting used for
* entities and proxies that are loaded into the session:
* @see org.hibernate.engine.spi.PersistenceContext#setDefaultReadOnly(boolean)
* @see Session#setDefaultReadOnly(boolean)
*
* Read-only entities are not dirty-checked and snapshots of persistent
* state are not maintained. Read-only entities can be modified, but
* changes are not persisted.
*
* When a proxy is initialized, the loaded entity will have the same
* read-only/modifiable setting as the uninitialized
* proxy has, regardless of the session's current setting.
*
* The read-only/modifiable setting has no impact on entities/proxies
* returned by the query that existed in the session before the query was executed.
*
* @return {@code this}, for method chaining
*
* @param readOnly {@code true} indicates that entities and proxies loaded by the query
* are to be put in read-only mode; {@code false} indicates that entities and proxies
* loaded by the query will be put in modifiable mode
*/
T setReadOnly(boolean readOnly);
/**
* Return the Hibernate types of the query results.
*
* @return an array of types
*
* @deprecated (since 5.2) with no replacement; to be removed in 6.0
*/
@Deprecated
Type[] getReturnTypes();
}

View File

@ -1,76 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate;
/**
* Thrown when a resource for a mapping could not be found.
*
* @author Max Rydahl Andersen
*
* @deprecated Use {@link org.hibernate.boot.MappingNotFoundException} instead.
*/
@Deprecated
public class MappingNotFoundException extends MappingException {
private final String path;
private final String type;
/**
* Constructs a MappingNotFoundException using the given information.
*
* @param customMessage A message explaining the exception condition
* @param type The type of mapping that could not be found
* @param path The path (type specific) of the mapping that could not be found
* @param cause The underlying cause
*/
public MappingNotFoundException(String customMessage, String type, String path, Throwable cause) {
super( customMessage, cause );
this.type = type;
this.path = path;
}
/**
* Constructs a MappingNotFoundException using the given information.
*
* @param customMessage A message explaining the exception condition
* @param type The type of mapping that could not be found
* @param path The path (type specific) of the mapping that could not be found
*/
public MappingNotFoundException(String customMessage, String type, String path) {
super( customMessage );
this.type = type;
this.path = path;
}
/**
* Constructs a MappingNotFoundException using the given information, using a standard message.
*
* @param type The type of mapping that could not be found
* @param path The path (type specific) of the mapping that could not be found
*/
public MappingNotFoundException(String type, String path) {
this( type + ": " + path + " not found", type, path );
}
/**
* Constructs a MappingNotFoundException using the given information, using a standard message.
*
* @param type The type of mapping that could not be found
* @param path The path (type specific) of the mapping that could not be found
* @param cause The underlying cause
*/
public MappingNotFoundException(String type, String path, Throwable cause) {
this( type + ": " + path + " not found", type, path, cause );
}
public String getType() {
return type;
}
public String getPath() {
return path;
}
}

View File

@ -1,29 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate;
import org.hibernate.dialect.lock.OptimisticEntityLockException;
/**
* Throw when an optimistic locking conflict occurs.
*
* @author Scott Marlow
*
* @deprecated Use {@link org.hibernate.dialect.lock.OptimisticEntityLockException} instead
*/
@Deprecated
public class OptimisticLockException extends OptimisticEntityLockException {
/**
* Constructs a OptimisticLockException using the specified information.
*
* @param entity The entity instance that could not be locked
* @param message A message explaining the exception condition
*/
public OptimisticLockException(Object entity, String message) {
super( entity, message );
}
}

View File

@ -6,8 +6,8 @@
*/ */
package org.hibernate.action.internal; package org.hibernate.action.internal;
import org.hibernate.OptimisticLockException;
import org.hibernate.action.spi.BeforeTransactionCompletionProcess; import org.hibernate.action.spi.BeforeTransactionCompletionProcess;
import org.hibernate.dialect.lock.OptimisticEntityLockException;
import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
@ -42,7 +42,7 @@ public class EntityVerifyVersionProcess implements BeforeTransactionCompletionPr
final EntityPersister persister = entry.getPersister(); final EntityPersister persister = entry.getPersister();
final Object latestVersion = persister.getCurrentVersion( entry.getId(), session ); final Object latestVersion = persister.getCurrentVersion( entry.getId(), session );
if ( !entry.getVersion().equals( latestVersion ) ) { if ( !entry.getVersion().equals( latestVersion ) ) {
throw new OptimisticLockException( throw new OptimisticEntityLockException(
object, object,
"Newer version [" + latestVersion + "Newer version [" + latestVersion +
"] of entity [" + MessageHelper.infoString( entry.getEntityName(), entry.getId() ) + "] of entity [" + MessageHelper.infoString( entry.getEntityName(), entry.getId() ) +

View File

@ -8,7 +8,6 @@ package org.hibernate.dialect.lock;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.OptimisticLockException;
import org.hibernate.action.internal.EntityVerifyVersionProcess; import org.hibernate.action.internal.EntityVerifyVersionProcess;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource; import org.hibernate.event.spi.EventSource;
@ -22,7 +21,6 @@ import org.hibernate.persister.entity.Lockable;
* @author Scott Marlow * @author Scott Marlow
* @since 3.5 * @since 3.5
*/ */
@SuppressWarnings("deprecation")
public class OptimisticLockingStrategy implements LockingStrategy { public class OptimisticLockingStrategy implements LockingStrategy {
private final Lockable lockable; private final Lockable lockable;
private final LockMode lockMode; private final LockMode lockMode;
@ -44,7 +42,7 @@ public class OptimisticLockingStrategy implements LockingStrategy {
@Override @Override
public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) { public void lock(Object id, Object version, Object object, int timeout, SharedSessionContractImplementor session) {
if ( !lockable.isVersioned() ) { if ( !lockable.isVersioned() ) {
throw new OptimisticLockException( object, "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" ); throw new OptimisticEntityLockException( object, "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
} }
// Register the EntityVerifyVersionProcess action to run just prior to transaction commit. // Register the EntityVerifyVersionProcess action to run just prior to transaction commit.
( (EventSource) session ).getActionQueue().registerProcess( new EntityVerifyVersionProcess( object ) ); ( (EventSource) session ).getActionQueue().registerProcess( new EntityVerifyVersionProcess( object ) );

View File

@ -20,7 +20,6 @@ import java.net.URL;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.InvalidMappingException; import org.hibernate.InvalidMappingException;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.MappingNotFoundException;
import org.hibernate.boot.jaxb.SourceType; import org.hibernate.boot.jaxb.SourceType;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.internal.util.ConfigHelper; import org.hibernate.internal.util.ConfigHelper;
@ -47,10 +46,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
cfg.addCacheableFile( "completelybogus.hbm.xml" ); cfg.addCacheableFile( "completelybogus.hbm.xml" );
fail(); fail();
} }
catch ( MappingNotFoundException e ) {
assertEquals( e.getType(), "file" );
assertEquals( e.getPath(), "completelybogus.hbm.xml" );
}
catch (org.hibernate.boot.MappingNotFoundException e) { catch (org.hibernate.boot.MappingNotFoundException e) {
assertEquals( e.getOrigin().getType(), SourceType.FILE ); assertEquals( e.getOrigin().getType(), SourceType.FILE );
assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" );
@ -60,10 +55,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
cfg.addCacheableFile( new File( "completelybogus.hbm.xml" ) ); cfg.addCacheableFile( new File( "completelybogus.hbm.xml" ) );
fail(); fail();
} }
catch ( MappingNotFoundException e ) {
assertEquals( e.getType(), "file" );
assertEquals( e.getPath(), "completelybogus.hbm.xml" );
}
catch (org.hibernate.boot.MappingNotFoundException e) { catch (org.hibernate.boot.MappingNotFoundException e) {
assertEquals( e.getOrigin().getType(), SourceType.FILE ); assertEquals( e.getOrigin().getType(), SourceType.FILE );
assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" );
@ -73,10 +64,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
cfg.addClass( Hibernate.class ); // TODO: String.class result in npe, because no classloader exists for it cfg.addClass( Hibernate.class ); // TODO: String.class result in npe, because no classloader exists for it
fail(); fail();
} }
catch ( MappingNotFoundException inv ) {
assertEquals( inv.getType(), "resource" );
assertEquals( inv.getPath(), "org/hibernate/Hibernate.hbm.xml" );
}
catch (org.hibernate.boot.MappingNotFoundException e) { catch (org.hibernate.boot.MappingNotFoundException e) {
assertEquals( e.getOrigin().getType(), SourceType.RESOURCE ); assertEquals( e.getOrigin().getType(), SourceType.RESOURCE );
assertEquals( e.getOrigin().getName(), "org/hibernate/Hibernate.hbm.xml" ); assertEquals( e.getOrigin().getName(), "org/hibernate/Hibernate.hbm.xml" );
@ -86,10 +73,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
cfg.addFile( "completelybogus.hbm.xml" ); cfg.addFile( "completelybogus.hbm.xml" );
fail(); fail();
} }
catch ( MappingNotFoundException e ) {
assertEquals( e.getType(), "file" );
assertEquals( e.getPath(), "completelybogus.hbm.xml" );
}
catch (org.hibernate.boot.MappingNotFoundException e) { catch (org.hibernate.boot.MappingNotFoundException e) {
assertEquals( e.getOrigin().getType(), SourceType.FILE ); assertEquals( e.getOrigin().getType(), SourceType.FILE );
assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" );
@ -99,10 +82,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
cfg.addFile( new File( "completelybogus.hbm.xml" ) ); cfg.addFile( new File( "completelybogus.hbm.xml" ) );
fail(); fail();
} }
catch ( MappingNotFoundException inv ) {
assertEquals( inv.getType(), "file" );
assertEquals( inv.getPath(), "completelybogus.hbm.xml" );
}
catch (org.hibernate.boot.MappingNotFoundException e) { catch (org.hibernate.boot.MappingNotFoundException e) {
assertEquals( e.getOrigin().getType(), SourceType.FILE ); assertEquals( e.getOrigin().getType(), SourceType.FILE );
assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" ); assertEquals( e.getOrigin().getName(), "completelybogus.hbm.xml" );
@ -125,10 +104,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
cfg.addResource( "nothere" ); cfg.addResource( "nothere" );
fail(); fail();
} }
catch ( MappingNotFoundException inv ) {
assertEquals( inv.getType(), "resource" );
assertEquals( inv.getPath(), "nothere" );
}
catch (org.hibernate.boot.MappingNotFoundException e) { catch (org.hibernate.boot.MappingNotFoundException e) {
assertEquals( e.getOrigin().getType(), SourceType.RESOURCE ); assertEquals( e.getOrigin().getType(), SourceType.RESOURCE );
assertEquals( e.getOrigin().getName(), "nothere" ); assertEquals( e.getOrigin().getName(), "nothere" );
@ -138,10 +113,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
cfg.addResource( "nothere", getClass().getClassLoader() ); cfg.addResource( "nothere", getClass().getClassLoader() );
fail(); fail();
} }
catch ( MappingNotFoundException inv ) {
assertEquals( inv.getType(), "resource" );
assertEquals( inv.getPath(), "nothere" );
}
catch (org.hibernate.boot.MappingNotFoundException e) { catch (org.hibernate.boot.MappingNotFoundException e) {
assertEquals( e.getOrigin().getType(), SourceType.RESOURCE ); assertEquals( e.getOrigin().getType(), SourceType.RESOURCE );
assertEquals( e.getOrigin().getName(), "nothere" ); assertEquals( e.getOrigin().getName(), "nothere" );
@ -181,7 +152,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
assertEquals( inv.getType(), "file" ); assertEquals( inv.getType(), "file" );
assertNotNull( inv.getPath() ); assertNotNull( inv.getPath() );
assertTrue( inv.getPath().endsWith( ".hbm.xml" ) ); assertTrue( inv.getPath().endsWith( ".hbm.xml" ) );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
try { try {
@ -192,7 +162,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
assertEquals( inv.getType(), "file" ); assertEquals( inv.getType(), "file" );
assertNotNull( inv.getPath() ); assertNotNull( inv.getPath() );
assertTrue( inv.getPath().endsWith( ".hbm.xml" ) ); assertTrue( inv.getPath().endsWith( ".hbm.xml" ) );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
try { try {
@ -202,7 +171,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
catch ( InvalidMappingException inv ) { catch ( InvalidMappingException inv ) {
assertEquals( inv.getType(), "resource" ); assertEquals( inv.getType(), "resource" );
assertEquals( inv.getPath(), "org/hibernate/test/mappingexception/InvalidMapping.hbm.xml" ); assertEquals( inv.getPath(), "org/hibernate/test/mappingexception/InvalidMapping.hbm.xml" );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
try { try {
@ -212,7 +180,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
catch ( InvalidMappingException inv ) { catch ( InvalidMappingException inv ) {
assertEquals( inv.getType(), "file" ); assertEquals( inv.getType(), "file" );
assertEquals( inv.getPath(), file.getPath() ); assertEquals( inv.getPath(), file.getPath() );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
try { try {
@ -222,7 +189,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
catch ( InvalidMappingException inv ) { catch ( InvalidMappingException inv ) {
assertEquals( inv.getType(), "file" ); assertEquals( inv.getType(), "file" );
assertEquals( inv.getPath(), file.getPath() ); assertEquals( inv.getPath(), file.getPath() );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
@ -233,7 +199,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
catch ( InvalidMappingException inv ) { catch ( InvalidMappingException inv ) {
assertEquals( inv.getType(), "input stream" ); assertEquals( inv.getType(), "input stream" );
assertEquals( inv.getPath(), null ); assertEquals( inv.getPath(), null );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
try { try {
@ -243,7 +208,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
catch ( InvalidMappingException inv ) { catch ( InvalidMappingException inv ) {
assertEquals( inv.getType(), "resource" ); assertEquals( inv.getType(), "resource" );
assertEquals( inv.getPath(), resourceName ); assertEquals( inv.getPath(), resourceName );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
try { try {
@ -253,7 +217,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
catch ( InvalidMappingException inv ) { catch ( InvalidMappingException inv ) {
assertEquals( inv.getType(), "resource" ); assertEquals( inv.getType(), "resource" );
assertEquals( inv.getPath(), resourceName ); assertEquals( inv.getPath(), resourceName );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
try { try {
@ -263,7 +226,6 @@ public class MappingExceptionTest extends BaseUnitTestCase {
catch ( InvalidMappingException inv ) { catch ( InvalidMappingException inv ) {
assertEquals( inv.getType(), "URL" ); assertEquals( inv.getType(), "URL" );
assertTrue( inv.getPath().endsWith( "InvalidMapping.hbm.xml" ) ); assertTrue( inv.getPath().endsWith( "InvalidMapping.hbm.xml" ) );
assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
} }
} }