Skip to content

Possibility to have a non-primary field with sequence generator or default value [DATAJDBC-623] #842

Closed
@spring-projects-issues

Description

@spring-projects-issues

Johan Blomgren opened DATAJDBC-623 and commented

I'm not sure if it's correct for me to post my improvement requests here? 

But i would like to one of these, or both.

Example with kotlin/postgres

Define sequence generator

@Table("foo")
data class Foo(
    @Id 
    val id: UUID, 
    @Sequence("external_id_seq") 
    val externalId: Long)
INSERT INTO foo(id, external_id) VALUES (?, nextval('external_id_seq')

or
Field uses default value if null 

@Table("foo")
data class Foo(
  @Id 
  val id: UUID, 
  @EmptyOnNull 
  val externalId: Long)
--Creates query, ignoring externalId since it should be empty if null. 
INSERT INTO foo(id) values (?)

No further details from DATAJDBC-623

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions