0

I am using spring boot(1.4),spring data and jpa. And using @Repository(CrudRepository) One of my Table/Entity, the ID column, I want to generate customised string. Start with some specific string plus creation data and time, and end with next value from db. so here I can't use @TableGenerator, I need some native query like "select nextvalue "

Is there better way can achieve this.

Manu
  • 1,243
  • 5
  • 17
  • 43

1 Answers1

0

Add a "normal" ID column using @Id and @GeneratedValue and then manually fill your special column after the entity has been stored the first time.

Tom
  • 3,913
  • 19
  • 28