Private Object key; as @Id

Can I use Object as datatype for Entity Id in hibernate 6

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", updatable = false, nullable = false)
    private Object key;

In Hibernate 5 I used to use this strategy and it worked perfectly:

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", updatable = false, nullable = false)
    @Type(type = java.lang.Integer.class)
    private Object key;

But now in Hibernate 6, I cant find a replacement

Did you try the following yet?

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", updatable = false, nullable = false)
@JavaType(IntegerJavaType.class)
private Object key;