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

introduce @ExcludeFromVersioning #669

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
42 changes: 42 additions & 0 deletions api/src/main/java/jakarta/persistence/ExcludeFromVersioning.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2008, 2024 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
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/

// Contributors:
// Gavin King - 4.0

package jakarta.persistence;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Specifies that mutation of the annotated field or property does
* not result in incrementation of the {@linkplain Version version
* field or property} of the entity.
* <p>
* This annotation indicates that the application tolerates lost
* updates to the annotated field or property when concurrent
* optimistic transactions modify the same entity instance, and
* that no {@link OptimisticLockException} should occur in this
* scenario.
*
* @see Version
*
* @since 4.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface ExcludeFromVersioning {}
1 change: 1 addition & 0 deletions api/src/main/java/jakarta/persistence/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
*
* @see LockModeType
* @see PersistenceUnitUtil#getVersion(Object)
* @see ExcludeFromVersioning
*
* @since 1.0
*/
Expand Down