Package com.axelor.db
Class JpaSequence
- java.lang.Object
-
- com.axelor.db.JpaSequence
-
public final class JpaSequence extends Object
This class provides some helper static methods to deal with custom sequences.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
nextValue(String name)
Get the next sequence value of the given sequence.
This method must be called inside a running transaction as it updates the sequence details in database.static void
nextValue(String name, long next)
Set the next numeric value for the given sequence.
This method must be called inside a running transaction as it updates the sequence details in the database.
-
-
-
Method Detail
-
nextValue
public static String nextValue(String name)
Get the next sequence value of the given sequence.
This method must be called inside a running transaction as it updates the sequence details in database.- Parameters:
name
- the name of the sequence- Returns:
- next sequence value
-
nextValue
public static void nextValue(String name, long next)
Set the next numeric value for the given sequence.
This method must be called inside a running transaction as it updates the sequence details in the database.
This method is generally used to reset the sequence. It may cause duplicates if given next number is less then the last next value of the sequence.- Parameters:
name
- the name of the sequencenext
- the next sequence number
-
-