cleanup
This commit is contained in:
parent
c8f36e78b7
commit
90299707ff
1 changed files with 4 additions and 24 deletions
|
|
@ -6,10 +6,7 @@ import io.vertx.mutiny.pgclient.PgPool;
|
||||||
import io.vertx.mutiny.sqlclient.Row;
|
import io.vertx.mutiny.sqlclient.Row;
|
||||||
import io.vertx.mutiny.sqlclient.RowSet;
|
import io.vertx.mutiny.sqlclient.RowSet;
|
||||||
import io.vertx.mutiny.sqlclient.Tuple;
|
import io.vertx.mutiny.sqlclient.Tuple;
|
||||||
import io.vertx.pgclient.PgConnectOptions;
|
|
||||||
import io.vertx.sqlclient.PoolOptions;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
@ -21,21 +18,6 @@ public class BewegingRepo {
|
||||||
@Inject
|
@Inject
|
||||||
PgPool client;
|
PgPool client;
|
||||||
|
|
||||||
// @PostConstruct
|
|
||||||
// public void init() {
|
|
||||||
// PgConnectOptions connectOptions = new PgConnectOptions()
|
|
||||||
// .setPort(5432)
|
|
||||||
// .setHost("localhost")
|
|
||||||
// .setDatabase("postgres")
|
|
||||||
// .setUser("postgres")
|
|
||||||
// .setPassword("sander");
|
|
||||||
//
|
|
||||||
// PoolOptions poolOptions = new PoolOptions()
|
|
||||||
// .setMaxSize(2);
|
|
||||||
//
|
|
||||||
// client = PgPool.pool(connectOptions, poolOptions);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public Uni<Beweging> getBeweging(String id) {
|
public Uni<Beweging> getBeweging(String id) {
|
||||||
String sql = "select * from beweging where id = $1";
|
String sql = "select * from beweging where id = $1";
|
||||||
|
|
||||||
|
|
@ -55,15 +37,13 @@ public class BewegingRepo {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Function<Row, Beweging> mapRow() {
|
|
||||||
return row -> new Beweging(row.getLong("id"), row.getLocalDate("vldatum"), row.getString("bewegingcode"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void persist(Beweging beweging) {
|
public void persist(Beweging beweging) {
|
||||||
client.preparedQuery("insert into beweging(vldatum, bewegingcode) values ($1,$2)")
|
client.preparedQuery("insert into beweging(vldatum, bewegingcode) values ($1,$2)")
|
||||||
.execute(Tuple.of(beweging.getVlDatum(), beweging.getBewegingcode())).await().indefinitely();
|
.execute(Tuple.of(beweging.getVlDatum(), beweging.getBewegingcode())).await().indefinitely();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Function<Row, Beweging> mapRow() {
|
||||||
|
return row -> new Beweging(row.getLong("id"), row.getLocalDate("vldatum"), row.getString("bewegingcode"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue