简体   繁体   中英

Result using spring data JPA Async queries

I've one question, I am using spring boot 1.5.9.RELEASE and spring data JPA with Hibernate.

My queries are like

@Async
CompletableFuture<User> findById(final long id);

And my question is, what result will I have if the id is not in the database? a CompletableFuture.completedFuture(null) or null directly?

Thanks in advance !.

You are going to have a CompletableFuture<User> with a null inside.

As a rule of thumb, any spring data jpa async repo calls would never itself be null.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM