Day 5, Java Holiday Calendar 2016, CRUD Operations

by Per Minborg

on December 5, 2016

5. CRUD Operations


Today’s tip is an introduction on how to use open-source Speedment to expand the Java 8 Streams to support Creating, Reading, Updating and Deleting database entities.

Head out to Speedment's GitHub page to see how to modify your project's POM file. Once you done the changes, you can connect to an existing database and generate Java code automatically from the database's meta information (like columns and tables). Once completed, your Java Streams becomes much more feature full and you can:

Do This:

hares.stream()
.filter(Hare.NAME.equal("Harry"))
.map(Hare.COLOR.setTo("Brown"))
.forEach(hares.updater());

// Sets the color to "Brown" for all hares named "Harry" in the DB

Read more on DZone at https://dzone.com/articles/database-crud-operations-in-java-8-streams

Follow the Java Holiday Calendar 2016 with small tips and tricks all the way through the winter holiday season.

About

Per Minborg

Per Minborg is a Palo Alto based developer and architect, currently serving as CTO at Speedment, Inc. He is a regular speaker at various conferences e.g. JavaOne, DevNexus, Jdays, JUGs and Meetups. Per has 15+ US patent applications and invention disclosures. He is a JavaOne alumni and co-author of the publication “Modern Java”.