HHH-6150 - JBoss AS7 integration work

This commit is contained in:
Steve Ebersole 2011-04-22 17:34:31 -05:00
parent 16e86687c9
commit f07b88c75f
7 changed files with 25 additions and 21 deletions

View File

@ -461,7 +461,7 @@ public final class AnnotationBinder {
}
//FIXME: work on initialValue() through SequenceGenerator.PARAMETERS
// steve : or just use o.h.id.enhanced.SequenceStyleGenerator
if (seqGen.initialValue() != 1) LOG.unsupportedInitialValue(Configuration.USE_NEW_ID_GENERATOR_MAPPINGS);
if (seqGen.initialValue() != 1) LOG.unsupportedInitialValue( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS);
idGen.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( seqGen.allocationSize() - 1 ) );
LOG.trace("Add sequence generator with name: " + idGen.getName());
}
@ -1020,12 +1020,12 @@ public final class AnnotationBinder {
return;
}
if ( !properties.containsKey( Configuration.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
if ( !properties.containsKey( AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
LOG.trace("Given properties did not contain any default cache concurrency strategy setting");
return;
}
final String strategyName = properties.getProperty( Configuration.DEFAULT_CACHE_CONCURRENCY_STRATEGY );
final String strategyName = properties.getProperty( AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY );
LOG.trace("Discovered default cache concurrency strategy via config [" + strategyName + "]");
CacheConcurrencyStrategy strategy = CacheConcurrencyStrategy.parse( strategyName );
if ( strategy == null ) {

View File

@ -514,4 +514,18 @@ public interface AvailableSettings {
* @since 4.0
*/
public static final String JTA_CACHE_UT = "hibernate.jta.cacheUserTransaction";
/**
* Setting used to give the name of the default {@link org.hibernate.annotations.CacheConcurrencyStrategy}
* to use when either {@link javax.persistence.Cacheable @Cacheable} or
* {@link org.hibernate.annotations.Cache @Cache} is used. {@link org.hibernate.annotations.Cache @Cache(strategy="..")} is used to override.
*/
public static final String DEFAULT_CACHE_CONCURRENCY_STRATEGY = "hibernate.cache.default_cache_concurrency_strategy";
/**
* Setting which indicates whether or not the new {@link org.hibernate.id.IdentifierGenerator} are used
* for AUTO, TABLE and SEQUENCE.
* Default to false to keep backward compatibility.
*/
public static final String USE_NEW_ID_GENERATOR_MAPPINGS = "hibernate.id.new_generator_mappings";
}

View File

@ -164,19 +164,9 @@ public class Configuration implements Serializable {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Configuration.class.getName());
/**
* Setting used to give the name of the default {@link org.hibernate.annotations.CacheConcurrencyStrategy}
* to use when either {@link javax.persistence.Cacheable @Cacheable} or
* {@link org.hibernate.annotations.Cache @Cache} is used. {@link org.hibernate.annotations.Cache @Cache(strategy="..")} is used to override.
*/
public static final String DEFAULT_CACHE_CONCURRENCY_STRATEGY = "hibernate.cache.default_cache_concurrency_strategy";
public static final String DEFAULT_CACHE_CONCURRENCY_STRATEGY = AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY;
/**
* Setting which indicates whether or not the new {@link org.hibernate.id.IdentifierGenerator} are used
* for AUTO, TABLE and SEQUENCE.
* Default to false to keep backward compatibility.
*/
public static final String USE_NEW_ID_GENERATOR_MAPPINGS = "hibernate.id.new_generator_mappings";
public static final String USE_NEW_ID_GENERATOR_MAPPINGS = AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS;
public static final String ARTEFACT_PROCESSING_ORDER = "hibernate.mapping.precedence";
@ -3042,7 +3032,7 @@ public class Configuration implements Serializable {
@SuppressWarnings({ "UnnecessaryUnboxing" })
public boolean useNewGeneratorMappings() {
if ( useNewGeneratorMappings == null ) {
final String booleanName = getConfigurationProperties().getProperty( USE_NEW_ID_GENERATOR_MAPPINGS );
final String booleanName = getConfigurationProperties().getProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS );
useNewGeneratorMappings = Boolean.valueOf( booleanName );
}
return useNewGeneratorMappings.booleanValue();

View File

@ -740,7 +740,7 @@ public interface Mappings {
/**
* Should we use the new generator strategy mappings. This is controlled by the
* {@link Configuration#USE_NEW_ID_GENERATOR_MAPPINGS} setting.
* {@link AvailableSettings#USE_NEW_ID_GENERATOR_MAPPINGS} setting.
*
* @return True if the new generators should be used, false otherwise.
*/

View File

@ -109,7 +109,7 @@ public abstract class BaseEntityManagerFunctionalTestCase extends BaseUnitTestCa
}
ejb3Configuration
.getHibernateConfiguration()
.setProperty( Configuration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
.setProperty( org.hibernate.cfg.AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
ejb3Configuration
.getHibernateConfiguration()
.setProperty( Environment.DIALECT, getDialect().getClass().getName() );

View File

@ -28,7 +28,6 @@ import javax.persistence.LockModeType;
import java.util.Map;
import org.hibernate.LockMode;
import org.hibernate.cfg.Configuration;
import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.QueryImpl;
import org.hibernate.ejb.test.BaseEntityManagerFunctionalTestCase;
@ -54,7 +53,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase {
@Override
@SuppressWarnings({ "unchecked" })
protected void addConfigOptions(Map options) {
options.put( Configuration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
options.put( org.hibernate.cfg.AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
}
@Test

View File

@ -38,6 +38,7 @@ import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.cache.HashtableCacheProvider;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Mappings;
@ -130,7 +131,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
protected Configuration constructConfiguration() {
Configuration configuration = new Configuration()
.setProperty( Environment.CACHE_PROVIDER, HashtableCacheProvider.class.getName() );
configuration.setProperty( Configuration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
configuration.setProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
if ( createSchema() ) {
configuration.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
}