From 61f4bf4f5697e2c73148a82dac3a9d277994a2dd Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Tue, 20 Apr 2021 10:11:03 +0200 Subject: [PATCH 1/2] #77: EntityManager(Factory) should implement AutoCloseable Signed-off-by: Lukas Jungmann --- api/src/main/java/jakarta/persistence/EntityManager.java | 4 ++-- .../java/jakarta/persistence/EntityManagerFactory.java | 4 ++-- spec/src/main/asciidoc/appendixes.adoc | 8 ++++++-- spec/src/main/asciidoc/ch03-entity-operations.adoc | 4 ++-- .../ch07-entitymanagers-and-persistence-contexts.adoc | 4 ++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/api/src/main/java/jakarta/persistence/EntityManager.java b/api/src/main/java/jakarta/persistence/EntityManager.java index 5ce57bf3..ff164582 100644 --- a/api/src/main/java/jakarta/persistence/EntityManager.java +++ b/api/src/main/java/jakarta/persistence/EntityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -51,7 +51,7 @@ * * @since 1.0 */ -public interface EntityManager { +public interface EntityManager extends AutoCloseable { /** * Make an instance managed and persistent. diff --git a/api/src/main/java/jakarta/persistence/EntityManagerFactory.java b/api/src/main/java/jakarta/persistence/EntityManagerFactory.java index 8696448c..faf7f36b 100644 --- a/api/src/main/java/jakarta/persistence/EntityManagerFactory.java +++ b/api/src/main/java/jakarta/persistence/EntityManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -32,7 +32,7 @@ * * @since 1.0 */ -public interface EntityManagerFactory { +public interface EntityManagerFactory extends AutoCloseable { /** * Create a new application-managed EntityManager. diff --git a/spec/src/main/asciidoc/appendixes.adoc b/spec/src/main/asciidoc/appendixes.adoc index e6b85256..298765be 100644 --- a/spec/src/main/asciidoc/appendixes.adoc +++ b/spec/src/main/asciidoc/appendixes.adoc @@ -1,5 +1,5 @@ // -// Copyright (c) 2017, 2020 Contributors to the Eclipse Foundation +// Copyright (c) 2017, 2021 Contributors to the Eclipse Foundation // [appendix] @@ -71,4 +71,8 @@ Packages of all API classes were changed to _jakarta.persistence_. These changes Schema namespaces were changed from http://xmlns.jcp.org/xml/ns/persistence and http://xmlns.jcp.org/xml/ns/persistence/orm to https://jakarta.ee/xml/ns/persistence and https://jakarta.ee/xml/ns/persistence/orm -References to schema versions lower than 2.2 were removed. \ No newline at end of file +References to schema versions lower than 2.2 were removed. + +=== Jakarta Persistence 3.0 + +EntityManagerFactory and EntityManager interfaces extend java.lang.AutoCloseable interface \ No newline at end of file diff --git a/spec/src/main/asciidoc/ch03-entity-operations.adoc b/spec/src/main/asciidoc/ch03-entity-operations.adoc index ac321b0e..360efa5c 100644 --- a/spec/src/main/asciidoc/ch03-entity-operations.adoc +++ b/spec/src/main/asciidoc/ch03-entity-operations.adoc @@ -1,5 +1,5 @@ // -// Copyright (c) 2017, 2020 Contributors to the Eclipse Foundation +// Copyright (c) 2017, 2021 Contributors to the Eclipse Foundation // == Entity Operations [[a1060]] @@ -84,7 +84,7 @@ import jakarta.persistence.criteria.CriteriaDelete; * * @since 1.0 */ -public interface EntityManager { +public interface EntityManager extends AutoCloseable { /** * Make an instance managed and persistent. diff --git a/spec/src/main/asciidoc/ch07-entitymanagers-and-persistence-contexts.adoc b/spec/src/main/asciidoc/ch07-entitymanagers-and-persistence-contexts.adoc index ba467be5..9e1367e8 100644 --- a/spec/src/main/asciidoc/ch07-entitymanagers-and-persistence-contexts.adoc +++ b/spec/src/main/asciidoc/ch07-entitymanagers-and-persistence-contexts.adoc @@ -1,5 +1,5 @@ // -// Copyright (c) 2017, 2020 Contributors to the Eclipse Foundation +// Copyright (c) 2017, 2021 Contributors to the Eclipse Foundation // == Entity Managers and Persistence Contexts [[a11431]] @@ -223,7 +223,7 @@ import jakarta.persistence.criteria.CriteriaBuilder; * * @since 1.0 */ -public interface EntityManagerFactory { +public interface EntityManagerFactory extends AutoCloseable { /** * Create a new application-managed EntityManager. From 7a5cc19c1f1b8214fe5161d4bd950c89f92abc4e Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Tue, 20 Apr 2021 10:34:50 +0200 Subject: [PATCH 2/2] oops, changes are for 3.1, not 3.0 Signed-off-by: Lukas Jungmann --- spec/src/main/asciidoc/appendixes.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/src/main/asciidoc/appendixes.adoc b/spec/src/main/asciidoc/appendixes.adoc index 298765be..f5c69f9c 100644 --- a/spec/src/main/asciidoc/appendixes.adoc +++ b/spec/src/main/asciidoc/appendixes.adoc @@ -73,6 +73,6 @@ to https://jakarta.ee/xml/ns/persistence and https://jakarta.ee/xml/ns/persisten References to schema versions lower than 2.2 were removed. -=== Jakarta Persistence 3.0 +=== Jakarta Persistence 3.1 EntityManagerFactory and EntityManager interfaces extend java.lang.AutoCloseable interface \ No newline at end of file