We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@configuration public class RxJava2JdbcConfig { /** * https://www.programcreek.com/java-api-examples/index.php?api=com.github.davidmoten.rx.jdbc.Database * @return * @throws Exception */ @bean public Database db() throws Exception { ConnectionProvider connection = ConnectionProvider.from("jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true", "root", "123456"); NonBlockingConnectionPool pool = Pools.nonBlocking() .maxPoolSize(Runtime.getRuntime().availableProcessors() * 5) .connectionProvider(connection) .build(); return Database.from(pool); } }
public Flux getAllAdverts3() { String sql = "SELECT name,code FROM company"; return Flux.from(db.select(sql).autoMap(Company.class)); }
@query("select name, code from company") public interface Company { @column("name") String name();
@Column("code") String code();
}
result :
[ {} ] but mysql have data
The text was updated successfully, but these errors were encountered:
Did you check for an error emission from the Flux?
Sorry, something went wrong.
Instead of using spring have you tried to connect to the database directly using rxjava2-jdbc?
No branches or pull requests
@configuration
public class RxJava2JdbcConfig {
/**
* https://www.programcreek.com/java-api-examples/index.php?api=com.github.davidmoten.rx.jdbc.Database
* @return
* @throws Exception
*/
@bean
public Database db() throws Exception {
ConnectionProvider connection = ConnectionProvider.from("jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true", "root", "123456");
NonBlockingConnectionPool pool =
Pools.nonBlocking()
.maxPoolSize(Runtime.getRuntime().availableProcessors() * 5)
.connectionProvider(connection)
.build();
return Database.from(pool);
}
}
public Flux getAllAdverts3() {
String sql = "SELECT name,code FROM company";
return Flux.from(db.select(sql).autoMap(Company.class));
}
@query("select name, code from company")
public interface Company {
@column("name")
String name();
}
result :
[
{}
]
but mysql have data
The text was updated successfully, but these errors were encountered: