Annotation for selecting the nextval of a sequence independently from @Id.
Add @EnableAspectJAutoProxy
and @ComponentScan(basePackages = "com.github.radtin")
to your Spring Boot project's configuration class.
@ComponentScan(basePackages = "com.github.radtin")
@EnableAspectJAutoProxy
public class ApplicationConfiguration {
}
In your entity
@Entity
@Table(name = "APPLICATION_ENTITY")
@Data
public class ApplicationEntity {
...
@OracleSequence(sequenceName = "APPLICATION_ENTITY_NUMBER_SEQ")
@Column(name = "APPLICATION_ENTITY_NUMBER")
private Long applicationEntityNumber;
...
}
Make sure you have your sequence created in your Oracle database.
create sequence APPLICATION_ENTITY_NUMBER_SEQ;
- Add support for more database sequences.