Description
I propose this enhancement, in a transacted select , with possibility of using annotated interface...
like
.flatMap(tx -> tx.select(Person.class)
instead of
.flatMap(tx -> tx.select("select * from person")
I put it on test in the example bellow and also I am displaying what I've been altering to your code in order for this to work :
Database.test()
.select(Person.class)
.parameter(2)
.transactedValuesOnly()
.get()
.flatMap(tx -> tx.update("update person set name=:name where id=:id")
.parameter("name", "blabla")
.parameter("id", tx.value().id())
.transactedValuesOnly()
.counts()
)
.flatMap(tx -> tx.select(Person.class)
.parameter(2)
.transactedValuesOnly()
.valuesOnly()
.get()
)
.subscribe(
v -> {out.println(v.name());},
e -> out.println(e.getMessage())
);
Here are the modifications I've made to your last version of code (maven 0.2.0 version - thanks for quick publishing btw .. I appreciate it )
in class : org.davidmoten.rx.jdbc.TxWithoutValue
add method :
<T> TransactedSelectAutomappedBuilder<T> select(Class<T> cls);
in class : org.davidmoten.rx.jdbc.TxImpl
add method :
@Override
public <T> TransactedSelectAutomappedBuilder<T> select(Class<T> cls) {
return db.tx(this).select(cls);
}
in class : org.davidmoten.rx.jdbc.TransactedBuilder
add method :
public <T> TransactedSelectAutomappedBuilder<T> select(@Nonnull Class<T> cls) {
Preconditions.checkNotNull(cls, "cls cannot be null");
return new SelectAutomappedBuilder(cls, connections, db).transacted();
}
I am not sure if is error free, I am not familiar with all the options this library has, but if you could look into it would be just great.