我已经预配置了数据库,但无法更改。应用程序的主键是最大长度为32的String。我有一个休眠实体,该实体当前正在使用uuid2策略生成应用程序ID。问题实际上是UUID长度为36,但我需要32。为我生成Application的ID对我来说更好吗?
贝娄是我当前实体的简化版本。
@Entity
public class Application {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String applicationId;
private String name;
}
Run Code Online (Sandbox Code Playgroud)