mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-23 14:32:04 +00:00
Update use example in README
This commit is contained in:
@@ -9,21 +9,34 @@ to integrate with Springs JDBC Transaction manager.
|
||||
## To use
|
||||
|
||||
```java
|
||||
ServerConfig serverConfig = new ServerConfig();
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
|
||||
// set SpringJdbcTransactionManager ... as the external transaction manager
|
||||
serverConfig.setExternalTransactionManager(new SpringJdbcTransactionManager());
|
||||
config.setExternalTransactionManager(new SpringJdbcTransactionManager());
|
||||
|
||||
...
|
||||
EbeanServer server = EbeanServerFactory.create(serverConfig);
|
||||
Database database = DatabaseFactory.create(config);
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can use Ebean in Spring/Spring Boot *without* this and that case Ebean
|
||||
manages the Transactions itself. With Ebean managing the transactions there
|
||||
manages the Transactions itself. With Ebean managing the transactions there
|
||||
are some benefits with more control over JDBC batch, getGeneratedKeys
|
||||
and a simpler abstraction (as Spring transactions is designed to manage
|
||||
multiple resources such as JDBC Transactions and JPA EntityManager and Ebean
|
||||
only needs to manage JDBC Transactions).
|
||||
only needs to manage JDBC Transactions).
|
||||
|
||||
|
||||
## Java modules
|
||||
|
||||
The module name is `io.ebean.spring.txn`
|
||||
|
||||
```java
|
||||
module foo {
|
||||
|
||||
requires io.ebean.spring.txn;
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user