Skip to content

Commit 2a20766

Browse files
committed
fix(ebean): improve data source handling
1 parent 22d2707 commit 2a20766

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/com/mengcraft/simpleorm/EbeanHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public void initialize() throws DatabaseException {
214214
if (!(server == null)) {
215215
throw new DatabaseException("Already initialized!");
216216
}
217-
if (mapping.size() < 1) {
217+
if (mapping.isEmpty()) {
218218
throw new DatabaseException("Not define entity class!");
219219
}
220220

@@ -384,7 +384,8 @@ public void shutdown() throws DatabaseException {
384384
val i = clz.getDeclaredConstructor(DefaultServer.class);
385385
i.setAccessible(true);
386386
((Runnable) i.newInstance(server)).run();
387-
if (dataSource instanceof HikariDataSource && !((HikariDataSource) dataSource).getPoolName().equals("simple_shared")) {// Never shutdown shared
387+
if (dataSource instanceof HikariDataSource &&
388+
((HikariDataSource) dataSource).getPoolName().equals(name)) {// Never shutdown shared
388389
((HikariDataSource) dataSource).close();
389390
}
390391
if (managed) {

0 commit comments

Comments
 (0)