World.java 809 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package models;
  2. import com.avaje.ebean.Ebean;
  3. import play.db.ebean.Model;
  4. import javax.persistence.Column;
  5. import javax.persistence.Entity;
  6. import javax.persistence.Id;
  7. import java.util.HashSet;
  8. import java.util.List;
  9. import java.util.Set;
  10. @Entity
  11. public class World extends Model {
  12. @Id
  13. public Long id;
  14. @Column(name = "randomNumber")
  15. public Long randomNumber;
  16. public static Finder<Long, World> find = new Finder<Long, World>(
  17. Long.class, World.class
  18. );
  19. public static List<World> save(final List<World> worlds) throws Throwable {
  20. Set<String> updateProperties = new HashSet<>();
  21. updateProperties.add("randomNumber");
  22. for (World world : worlds) {
  23. Ebean.update(world, updateProperties);
  24. }
  25. return worlds;
  26. }
  27. }