Skip to content

Support for Oracle sequence [DATAJDBC-299] #479

@spring-projects-issues

Description

@spring-projects-issues

Tomas-Mrazek opened DATAJDBC-299 and commented

Oracle 11g doesn't have auto increment as 12c, so the only option is to use explicit sequence (or slow trigger).

Setting up ID during BeforeSaveEvent causes this error, therefore it's not currently possible to use this library with Oracle 11g without a custom tweak. Related to DATAJDBC-256.

OJDBC driver correctly returns ID from sequence, if nextval is called in the same SQL query – according to official documentation.

I suggest to add a possibility to include name of sequence and then internally append query to insert @Id column with VALUE("LEGO_SEQ.NEXTVAL). Sequence could be configured via another annotation.

@Sequence("LEGO_SEQ")
@Table("LEGO")
public class LegoEntity {
    @Id
    Long id;
    String color;
    String shape;
}

Setting up custom ID is also not supported, so this issue is partially related to a stackoverflow question and DATAJDBC-269


5 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions