SPRING JDBC / NOTES</>↗Spring JDBC22 Jul 2010
In this example you will learn how to select records from the database using JdbcTemplate.queryForList() method. This method returns a List object which stores information selected from the table in a HashMap object. The key of the map is the table’s field names while the value of the map contains the corresponding table’s field value. […]
SPRING JDBC / NOTES</>↗Spring JDBC19 Jul 2010
The code below demonstrates on how to delete some records from database using the JdbcTemplate. package org.kodejava.spring.jdbc; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; import javax.sql.DataSource; public class DeleteDemo { public static final String DRIVER = "com.mysql.cj.jdbc.Driver"; public static final String URL = "jdbc:mysql://localhost/musicdb"; public static final String USERNAME = "root";...
SPRING JDBC / NOTES</>↗Spring JDBC17 Jul 2010
The example demonstrated below will show you how to use the JdbcTemplate.update() method for updating records in database. This method returns an integer value indicating number of records updated in the database when the query is executed. package org.kodejava.spring.jdbc; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; import javax.sql.DataSource; import java.sql.Types; import java.util.Date; public clas...
CORE API / NOTES</>↗Core API13 Jul 2010
package org.kodejava.util; import java.util.*; public class SortedMapDemo { public static void main(String[] args) { SortedMap<String, String> sorted = new TreeMap<>(); sorted.put("United States", "New York"); sorted.put("United Kingdom", "London"); sorted.put("Netherlands", "Amsterdam"); sorted.put("Japan", "Tokyo"); sorted.put("France", "Paris"); // Gets the first(lowest) key currently in this map String firstKey = sorted.firstKey(); // Gets the last (highest) key currently...
CORE API / NOTES</>↗Core API10 Jul 2010
This example demonstrates how to convert a Vector object into an array. You can use the Vector.copyInto(Object[] array) method to create a copy of the Vector object in array form. package org.kodejava.util; import java.util.Vector; public class VectorToArray { public static void main(String[] args) { Vector<Integer> vector = new Vector<>(); vector.add(10); vector.add(20); vector.add(30); vector.add(40); vector.add(50); // […]
BASIC / NOTES</>↗Basic06 Jul 2010
The signed shift right operator >> shifts a bit pattern to the right. This operator operates with two operand, the left-hand operand to be shifted and the right-hand operand tells how much position to shift. Shifting a 1000 bit pattern using the >> operator 2 position will produce a 0010 bit pattern. The signed shift […]