Fixed formatting and spelling mistakes
This commit is contained in:
@@ -25,13 +25,13 @@ public class SpringBootApp {
|
||||
@PostConstruct
|
||||
private void initDb() {
|
||||
System.out.println(String.format(
|
||||
"****** Creating table: %s, and Inserting test data ******", "Employees"));
|
||||
"****** Creating table: %s, and Inserting test data ******", "Employees"));
|
||||
|
||||
String sqlStatements[] = {
|
||||
"drop table employees if exists",
|
||||
"create table employees(id serial,first_name varchar(255),last_name varchar(255))",
|
||||
"insert into employees(first_name, last_name) values('Eugen','Paraschiv')",
|
||||
"insert into employees(first_name, last_name) values('Scott','Tiger')"
|
||||
"drop table employees if exists",
|
||||
"create table employees(id serial,first_name varchar(255),last_name varchar(255))",
|
||||
"insert into employees(first_name, last_name) values('Eugen','Paraschiv')",
|
||||
"insert into employees(first_name, last_name) values('Scott','Tiger')"
|
||||
};
|
||||
|
||||
Arrays.asList(sqlStatements).stream().forEach(sql -> {
|
||||
@@ -41,20 +41,20 @@ public class SpringBootApp {
|
||||
|
||||
System.out.println(String.format("****** Fetching from table: %s ******", "Employees"));
|
||||
jdbcTemplate.query("select id,first_name,last_name from employees",
|
||||
new RowMapper<Object>() {
|
||||
@Override
|
||||
public Object mapRow(ResultSet rs, int i) throws SQLException {
|
||||
System.out.println(String.format("id:%s,first_name:%s,last_name:%s",
|
||||
rs.getString("id"),
|
||||
rs.getString("first_name"),
|
||||
rs.getString("last_name")));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
new RowMapper<Object>() {
|
||||
@Override
|
||||
public Object mapRow(ResultSet rs, int i) throws SQLException {
|
||||
System.out.println(String.format("id:%s,first_name:%s,last_name:%s",
|
||||
rs.getString("id"),
|
||||
rs.getString("first_name"),
|
||||
rs.getString("last_name")));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public Server inMemoryH2DatabaseaServer() throws SQLException {
|
||||
public Server inMemoryH2DatabaseServer() throws SQLException {
|
||||
return Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", "9091");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ public class ClientSpringBootApp {
|
||||
private void initDb() {
|
||||
System.out.println("****** Inserting more sample data in the table: Employees ******");
|
||||
String sqlStatements[] = {
|
||||
"insert into employees(first_name, last_name) values('Donald','Trump')",
|
||||
"insert into employees(first_name, last_name) values('Barack','Obama')"
|
||||
"insert into employees(first_name, last_name) values('Donald','Trump')",
|
||||
"insert into employees(first_name, last_name) values('Barack','Obama')"
|
||||
};
|
||||
|
||||
Arrays.asList(sqlStatements).stream().forEach(sql -> {
|
||||
@@ -35,15 +35,15 @@ public class ClientSpringBootApp {
|
||||
|
||||
System.out.println(String.format("****** Fetching from table: %s ******", "Employees"));
|
||||
jdbcTemplate.query("select id,first_name,last_name from employees",
|
||||
new RowMapper<Object>() {
|
||||
@Override
|
||||
public Object mapRow(ResultSet rs, int i) throws SQLException {
|
||||
System.out.println(String.format("id:%s,first_name:%s,last_name:%s",
|
||||
rs.getString("id"),
|
||||
rs.getString("first_name"),
|
||||
rs.getString("last_name")));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
new RowMapper<Object>() {
|
||||
@Override
|
||||
public Object mapRow(ResultSet rs, int i) throws SQLException {
|
||||
System.out.println(String.format("id:%s,first_name:%s,last_name:%s",
|
||||
rs.getString("id"),
|
||||
rs.getString("first_name"),
|
||||
rs.getString("last_name")));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user