Skip to content

Supporting SQL Function around inserting value [DATAJDBC-468] #694

@spring-projects-issues

Description

@spring-projects-issues

LaoTsing opened DATAJDBC-468 and commented

We can use annotations to insert value as any SQL function:

@UpdateStrategy(JdbcStrategy.UpdateIsNotNull)

public class DocEntity {

   @Id private Long id;

   private String english;

   @Fun("translate('french', english)") private String french;

}

 

in annotation Fun("translate('french', ?)") we can select character "?" and get value from any primitive type of "french" field

then repository.save(doc) with english == null generate:

update doc set ``french=translate('french', ``english``) where id=?

this will greatly simplify the logic and source code.

In SELECT case, the annotated functions can reveal their full potential


Issue Links:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions