Merge remote-tracking branch 'upstream/main' into wip/6.0_merge_main_7

This commit is contained in:
Andrea Boriero 2021-10-01 11:34:10 +02:00
commit 8c40de9cff
5 changed files with 5 additions and 71 deletions

View File

@ -1,62 +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.userguide.jmx;
import java.util.Map;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.TestForIssue;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
/**
* @author Vlad Mihalcea
*/
public class JmxTest extends BaseEntityManagerFunctionalTestCase {
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] {
Person.class,
};
}
@Override
protected Map buildSettings() {
Map properties = super.buildSettings();
properties.put( AvailableSettings.GENERATE_STATISTICS, Boolean.TRUE.toString());
properties.put( AvailableSettings.JMX_ENABLED, Boolean.TRUE.toString());
properties.put( AvailableSettings.JMX_DOMAIN_NAME, "test");
return properties;
}
@Test
@TestForIssue( jiraKey = "HHH-7405" )
public void test() {
doInJPA( this::entityManagerFactory, entityManager -> {
Person person = new Person();
person.id = 1L;
entityManager.persist(person);
});
}
@Entity(name = "Person")
public static class Person {
@Id
private Long id;
private String firstName;
private String lastName;
}
}

View File

@ -47,7 +47,7 @@ ext {
jakartaJaxbRuntimeVersion = '3.0.2' jakartaJaxbRuntimeVersion = '3.0.2'
//GraalVM //GraalVM
graalvmVersion = '19.3.1' graalvmVersion = '21.2.0'
antlrVersion = '4.9.1' antlrVersion = '4.9.1'

View File

@ -1847,13 +1847,6 @@ public interface AvailableSettings {
*/ */
String HBM2DDL_DEFAULT_CONSTRAINT_MODE = "hibernate.hbm2ddl.default_constraint_mode"; String HBM2DDL_DEFAULT_CONSTRAINT_MODE = "hibernate.hbm2ddl.default_constraint_mode";
String JMX_ENABLED = "hibernate.jmx.enabled";
String JMX_PLATFORM_SERVER = "hibernate.jmx.usePlatformServer";
String JMX_AGENT_ID = "hibernate.jmx.agentId";
String JMX_DOMAIN_NAME = "hibernate.jmx.defaultDomain";
String JMX_SF_NAME = "hibernate.jmx.sessionFactoryName";
String JMX_DEFAULT_OBJ_NAME_DOMAIN = "org.hibernate.core";
/** /**
* Setting to identify a {@link org.hibernate.CustomEntityDirtinessStrategy} to use. May point to * Setting to identify a {@link org.hibernate.CustomEntityDirtinessStrategy} to use. May point to
* either a class name or instance. * either a class name or instance.

View File

@ -42,7 +42,10 @@ public abstract class AbstractPreDatabaseOperationEvent extends AbstractEvent {
* Retrieves the entity involved in the database operation. * Retrieves the entity involved in the database operation.
* *
* @return The entity. * @return The entity.
*
* @deprecated Support for JACC will be removed in 6.0
*/ */
@Deprecated
public Object getEntity() { public Object getEntity() {
return entity; return entity;
} }

View File

@ -448,7 +448,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
} }
else { else {
// Because of https://hibernate.atlassian.net/browse/HHH-5529, // Because of https://hibernate.atlassian.net/browse/HHH-5529,
// we can'trely on a Bulk Delete query which will not clear the link tables in @ElementCollection or unidirectional collections // we can't rely on a Bulk Delete query which will not clear the link tables in @ElementCollection or unidirectional collections
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, s -> {
s.createQuery( "from java.lang.Object" ).list().forEach( s::remove ); s.createQuery( "from java.lang.Object" ).list().forEach( s::remove );
} ); } );