I have the following code. Because the @Id
value is generated sequentially in my MariaDB
, it's not safe: I need to expose it in the clients. That's why I want a unpredictable random @Id
. How should I change the code?
@Entity
public class Item implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id; // Automatic generated value
// other fields, getters, setters & constructors
}