Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
import static org.hibernate.internal.util.config.ConfigurationHelper.getInteger;
import static org.hibernate.internal.util.config.ConfigurationHelper.getString;
import static org.hibernate.jpa.internal.util.CacheModeHelper.interpretCacheMode;
import static org.hibernate.jpa.internal.util.ConfigurationHelper.getFlushMode;
import static org.hibernate.type.format.jackson.JacksonIntegration.getJsonJacksonFormatMapperOrNull;
import static org.hibernate.type.format.jackson.JacksonIntegration.getXMLJacksonFormatMapperOrNull;
import static org.hibernate.type.format.jakartajson.JakartaJsonIntegration.getJakartaJsonBFormatMapperOrNull;
Expand Down Expand Up @@ -1620,9 +1621,8 @@ public LockOptions getDefaultLockOptions() {
return defaultLockOptions;
}

private static FlushMode defaultFlushMode(Map<String, Object> defaultSessionProperties) {
final Object setMode = defaultSessionProperties.get( HibernateHints.HINT_FLUSH_MODE );
return org.hibernate.jpa.internal.util.ConfigurationHelper.getFlushMode( setMode, FlushMode.AUTO );
private static FlushMode defaultFlushMode(Map<String, Object> properties) {
return getFlushMode( properties.get( HibernateHints.HINT_FLUSH_MODE ), FlushMode.AUTO );
}

private static LockOptions defaultLockOptions(Map<String, Object> defaultSessionProperties) {
Expand All @@ -1640,9 +1640,9 @@ private Map<String, Object> initializeDefaultSessionProperties(ConfigurationServ
final HashMap<String,Object> settings = new HashMap<>();

//Static defaults:
settings.putIfAbsent( HibernateHints.HINT_FLUSH_MODE, FlushMode.AUTO.name() );
settings.putIfAbsent( JPA_LOCK_SCOPE, PessimisticLockScope.EXTENDED.name() );
settings.putIfAbsent( JAKARTA_LOCK_SCOPE, PessimisticLockScope.EXTENDED.name() );
settings.putIfAbsent( HibernateHints.HINT_FLUSH_MODE, FlushMode.AUTO );
settings.putIfAbsent( JPA_LOCK_SCOPE, PessimisticLockScope.EXTENDED );
settings.putIfAbsent( JAKARTA_LOCK_SCOPE, PessimisticLockScope.EXTENDED );
settings.putIfAbsent( JPA_LOCK_TIMEOUT, LockOptions.WAIT_FOREVER );
settings.putIfAbsent( JAKARTA_LOCK_TIMEOUT, LockOptions.WAIT_FOREVER );
settings.putIfAbsent( JPA_SHARED_CACHE_RETRIEVE_MODE, CacheModeHelper.DEFAULT_RETRIEVE_MODE );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,14 @@ private Integer getHintedLockTimeout() {

private Object getSessionProperty(String propertyName) {
return properties == null
? getSessionFactoryOptions().getDefaultSessionProperties().get( propertyName )
? getDefaultProperties().get( propertyName )
: properties.get( propertyName );
}

private Map<String, Object> getDefaultProperties() {
return getSessionFactoryOptions().getDefaultSessionProperties();
}

@Override
public SharedSessionBuilder sessionWithOptions() {
return new SharedSessionBuilderImpl( this );
Expand Down Expand Up @@ -2810,7 +2814,7 @@ public void setProperty(String propertyName, Object value) {

// store property for future reference:
if ( properties == null ) {
properties = computeCurrentSessionProperties();
properties = computeCurrentProperties();
}
properties.put( propertyName, value );

Expand Down Expand Up @@ -2878,18 +2882,18 @@ private void interpretProperty(String propertyName, Object value) {
}
}

private Map<String, Object> computeCurrentSessionProperties() {
final Map<String, Object> map = new HashMap<>( getSessionFactoryOptions().getDefaultSessionProperties() );
private Map<String, Object> computeCurrentProperties() {
final var map = new HashMap<>( getDefaultProperties() );
//The FLUSH_MODE is always set at Session creation time,
//so it needs special treatment to not eagerly initialize this Map:
map.put( HINT_FLUSH_MODE, getHibernateFlushMode().name() );
map.put( HINT_FLUSH_MODE, getHibernateFlushMode() );
return map;
}

@Override
public Map<String, Object> getProperties() {
if ( properties == null ) {
properties = computeCurrentSessionProperties();
properties = computeCurrentProperties();
}
return unmodifiableMap( properties );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*/
package org.hibernate.jpa;

import org.hibernate.type.BindableType;

/**
* List of Hibernate-specific (extension) hints available to query,
* load, and lock scenarios.
Expand Down Expand Up @@ -167,15 +165,15 @@ public interface HibernateHints {

/**
* The {@linkplain org.hibernate.type.SqlTypes JDBC type code},
* {@linkplain BindableType type}, or
* {@linkplain jakarta.persistence.metamodel.Type type}, or
* {@link Class} of the value returned by a SQL function called
* via {@link org.hibernate.procedure.ProcedureCall} or
* {@link jakarta.persistence.StoredProcedureQuery}. Has the side
* effect of causing the call to be treated as a function call
* rather than a call to a stored procedure.
*
* @see org.hibernate.procedure.ProcedureCall#markAsFunctionCall(int)
* @see org.hibernate.procedure.ProcedureCall#markAsFunctionCall(BindableType)
* @see org.hibernate.procedure.ProcedureCall#markAsFunctionCall(jakarta.persistence.metamodel.Type)
* @see org.hibernate.procedure.ProcedureCall#markAsFunctionCall(Class)
*/
String HINT_CALLABLE_FUNCTION_RETURN_TYPE = "hibernate.procedure.function_return_jdbc_type_code";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.hibernate.dialect.NullOrdering;

import jakarta.persistence.criteria.Nulls;
import org.hibernate.query.internal.NullPrecedenceHelper;

/**
* Enumerates the possibilities for the precedence of null values within
Expand Down Expand Up @@ -38,21 +39,7 @@ public enum NullPrecedence {
*/
@Deprecated(since = "7.0", forRemoval = true)
public boolean isDefaultOrdering(SortDirection sortOrder, NullOrdering nullOrdering) {
return switch (this) {
case NONE -> true;
case FIRST -> switch (nullOrdering) {
case FIRST -> true;
case LAST -> false;
case SMALLEST -> sortOrder == SortDirection.ASCENDING;
case GREATEST -> sortOrder == SortDirection.DESCENDING;
};
case LAST -> switch (nullOrdering) {
case LAST -> true;
case FIRST -> false;
case SMALLEST -> sortOrder == SortDirection.DESCENDING;
case GREATEST -> sortOrder == SortDirection.ASCENDING;
};
};
return NullPrecedenceHelper.isDefaultOrdering( getJpaValue(), sortOrder, nullOrdering );
}

/**
Expand Down Expand Up @@ -99,6 +86,5 @@ public static NullPrecedence fromJpaValue(Nulls jpaValue) {
case FIRST -> NullPrecedence.FIRST;
case LAST -> NullPrecedence.LAST;
};

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class DelegatingDomainQueryExecutionContext implements DomainQueryExecutionContext {
private final DomainQueryExecutionContext delegate;

public <R> DelegatingDomainQueryExecutionContext(DomainQueryExecutionContext delegate) {
public DelegatingDomainQueryExecutionContext(DomainQueryExecutionContext delegate) {
this.delegate = delegate;
}

Expand Down

This file was deleted.

This file was deleted.

Loading