Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Latest commit

 

History

History
43 lines (29 loc) · 869 Bytes

README.md

File metadata and controls

43 lines (29 loc) · 869 Bytes

sequence-jpa-spring-boot

Annotation for selecting the nextval of a sequence independently from @Id.

Installation

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;

TODO

  • Add support for more database sequences.