Search code examples
javaebeanplayframework-2.4

What is the difference in saving?


I know that I can save my objects in two different ways. But what is the diference between these lines?

Ebean.save(network);
network.save();

Solution

  • There is no difference.

    The Play framework provides the save() method, and others, by default on all model types that are mapped as persisted entities.

    The method does the same thing as Ebean.save() but gives the benefit of abstracting away the details of the vendor specific ORM being used. If you are using Play framework, it is a best practice to call the save() method directly on your model/entity than to call methods on EBean directly.