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

benjaminjacobberg/sequence-jpa-spring-boot

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages