play-java-ebean-example icon indicating copy to clipboard operation
play-java-ebean-example copied to clipboard

Why are you setting the computer id based on the time?

Open kdbeall opened this issue 7 years ago • 2 comments

Why are you setting the id based on the time? In your ComputerRepository.java

public CompletionStage<Long> insert(Computer computer) {
        return supplyAsync(() -> {
             computer.id = System.currentTimeMillis(); // not ideal, but it works
             ebeanServer.insert(computer);
             return computer.id;
        }, executionContext);
    }

kdbeall avatar Feb 18 '18 21:02 kdbeall

Doesn't ebean do this automagically?

kdbeall avatar Feb 18 '18 23:02 kdbeall

Hi @kdbeall, it is just an example, so not a big deal. But yeah, Ebean should handle it, I think.

Do you want to submit a pull request to improve this?

Thank you.

marcospereira avatar Feb 21 '18 15:02 marcospereira