Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two minor things for 3.2 #611

Merged
merged 2 commits into from
Apr 10, 2024
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
2 changes: 2 additions & 0 deletions api/src/main/java/jakarta/persistence/Column.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
* should not be stored in a {@code time} column, or that the
* maximum number of digits supported by the database and JDBC
* driver should be stored in a {@code timestamp} column.
*
* @since 3.2
*/
int secondPrecision() default -1;

Expand Down
1 change: 1 addition & 0 deletions api/src/main/java/jakarta/persistence/EntityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ <T> T find(EntityGraph<T> entityGraph, Object primaryKey,
* an entity, or if it is neither persistent nor detached
* @throws EntityNotFoundException if the entity state cannot be
* accessed
* @since 3.2
*/
<T> T getReference(T entity);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ public interface EntityManagerFactory extends AutoCloseable {
* meaning all queries
* @return a map keyed by query name
* @param <R> the specified upper bound on the query result types
*
* @since 3.2
*/
<R> Map<String, TypedQueryReference<R>> getNamedQueries(Class<R> resultType);

Expand All @@ -364,6 +366,8 @@ public interface EntityManagerFactory extends AutoCloseable {
* meaning all entity graphs
* @return a map keyed by graph name
* @param <E> the specified upper bound on the entity graph types
*
* @since 3.2
*/
<E> Map<String, EntityGraph<? extends E>> getNamedEntityGraphs(Class<E> entityType);

Expand All @@ -389,6 +393,8 @@ public interface EntityManagerFactory extends AutoCloseable {
* control to the client.
*
* @param work a function to be executed in the scope of the transaction
*
* @since 3.2
*/
void runInTransaction(Consumer<EntityManager> work);
/**
Expand All @@ -415,6 +421,8 @@ public interface EntityManagerFactory extends AutoCloseable {
*
* @param work a function to be called in the scope of the transaction
* @return the value returned by the given function
*
* @since 3.2
*/
<R> R callInTransaction(Function<EntityManager, R> work);
}
2 changes: 2 additions & 0 deletions api/src/main/java/jakarta/persistence/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ default Stream getResultStream() {
* @throws PersistenceException if the query execution exceeds
* the query timeout value set and the transaction
* is rolled back
*
* @since 3.2
*/
Object getSingleResultOrNull();

Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/jakarta/persistence/TypedQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ default Stream<X> getResultStream() {
* @throws PersistenceException if the query execution exceeds
* the query timeout value set and the transaction
* is rolled back
*
* @since 3.2
*/
X getSingleResultOrNull();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* @param <R> an upper bound on the result type of the query
*
* @see EntityManager#createQuery(TypedQueryReference)
*
* @since 3.2
*/
public interface TypedQueryReference<R> {
/**
Expand Down
2 changes: 1 addition & 1 deletion spec/src/main/asciidoc/appA-revision-history.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Added `comment` and `check` members to `@Table` and `@Column` annotations, along

Added `secondPrecision` to `@Column` annotation and clarified semantics of `@Column` members

Added factory-level access to named queries and named entity graphs
Added factory-level access to named queries and named entity graphs, along with `TypedQueryReference`

Added integration points for dependency injection

Expand Down