spring-projects / spring-projects/spring-data-relational
Supporting SQL Function around inserting value [DATAJDBC-468]
@schauder is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 827
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
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:
- DATAJDBC-397 SpEL support for
@Queryannotation
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.