-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
hibernate-rx-core/src/main/java/org/hibernate/rx/service/RxDummyConnectionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.hibernate.rx.service; | ||
|
||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
public class RxDummyConnectionProvider implements ConnectionProvider { | ||
@Override | ||
public Connection getConnection() throws SQLException { | ||
throw new SQLException("Not using JDBC"); | ||
} | ||
|
||
@Override | ||
public void closeConnection(Connection conn) {} | ||
|
||
@Override | ||
public boolean supportsAggressiveRelease() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isUnwrappableAs(Class unwrapType) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public <T> T unwrap(Class<T> unwrapType) { | ||
return null; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
hibernate-rx-core/src/main/java/org/hibernate/rx/service/RxGenerationTarget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.hibernate.rx.service; | ||
|
||
import org.hibernate.rx.service.initiator.RxConnectionPoolProvider; | ||
import org.hibernate.service.ServiceRegistry; | ||
import org.hibernate.tool.schema.internal.exec.GenerationTarget; | ||
|
||
/** | ||
* Adaptor that redirects DDL generated by the schema export | ||
* tool to the reactive connection. | ||
* | ||
* @author Gavin King | ||
*/ | ||
public class RxGenerationTarget implements GenerationTarget { | ||
RxConnection connection; | ||
private ServiceRegistry registry; | ||
|
||
public RxGenerationTarget(ServiceRegistry registry) { | ||
this.registry = registry; | ||
} | ||
|
||
@Override | ||
public void prepare() { | ||
connection = registry.getService( RxConnectionPoolProvider.class ).getConnection(); | ||
} | ||
|
||
@Override | ||
public void accept(String command) { | ||
try { | ||
connection.preparedQuery(command).toCompletableFuture().join(); | ||
} | ||
catch (Exception e) { | ||
System.out.println( e.getMessage() ); | ||
} | ||
} | ||
|
||
@Override | ||
public void release() { | ||
connection.close(); | ||
connection = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters