ustad
ustad

Reputation: 539

Associate JDBC Datasource Name Using @JdbcRepository annotation

In the docs, it states,

The @JdbcRepository annotation accepts an optional string value which represents the name of the connection or datasource in a multiple datasource scenario. By default Micronaut Data will look for the default datasource.

However, I don't see any such value parameter within this annotation - only the dialect. Is this an error or am I missing something?

Upvotes: 2

Views: 475

Answers (2)

Espresso
Espresso

Reputation: 5739

Here is a complete snippet, using dialect & datasource:

@Repository(value = "inventoryDataSource")
@JdbcRepository(dialect = Dialect.ORACLE)
public interface PhoneRepository extends CrudRepository<Phone, Integer> {
    Optional<Phone> findByAssetId(@NotNull Integer assetId);
}

A patch/pull request has been submitted with correction to the documentation.

Upvotes: 1

Jeff Scott Brown
Jeff Scott Brown

Reputation: 27220

Is this an error or am I missing something?

I think it is the former. If you file an issue at https://github.com/micronaut-projects/micronaut-data/issues we can take care of that.

Thanks for the feedback!

Upvotes: 1

Related Questions