Closed xupeixuan closed 6 years ago
Hi @xupeixuan, Is this issue still open?
Apologies to keep this issue open for so long.
The database extension is just a sample extension for translating common database operations to Functions and Suppliers for use by other parts of Agera (mainly the Repositories). The database is supposed to have come from a SqlDatabaseSupplier, also available from the same extension, which is an SqlOpenHelper and does not automatically close the database connection, and therefore the IllegalStateException you mentioned should be unreachable, unless your code manually closes the connection. Then, because the SqlDatabaseSupplier is itself the SqlOpenHelper, closing the database means the end-of-life of the SqlDatabaseSupplier, and therefore any Function created with SqlDatabaseFunctions class, which permanently holds onto the (now dead) SqlDatabaseSupplier, should no longer be used.
If you want to be able to close the database connection and keep using the same Supplier instance to automatically reopen the database for more operations, consider building a custom class.
Hope this helps!
ok,thanks.
SqlDatabaseFunctions class should add catch IllegalStateException when do merge operator. this will happen "java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed." thx.