1

I have the following Id description of my entity in JPA:

@Id
@SequenceGenerator(name = "my_sequence", sequenceName = "my_seq")
@GeneratedValue(generator = "my_sequence", strategy = GenerationType.SEQUENCE)
private long id;

and it works from Java. Unfortunately, in MariaDB database it is creating, I don't see any column properties about generating ids. I.e. field is not autoincrement. If I add new row to the table with database tool, it says id can't be null.

How to configure it to work both client side and server side?

Dims
  • 47,675
  • 117
  • 331
  • 600
  • 1
    autoincrement is used for GenerationType.IDENTITY. I never used Sequences for IDs, but in Mariadb they're only available since Version 10.3. Maybe that's your Problem. If it isn't, maybe this Link is useful: https://vladmihalcea.com/jpa-entity-identifier-sequence/ – frank Apr 16 '21 at 12:37

0 Answers0