1

Silly question - how do you create entities in Spring Data R2DBC? All examples I struck on create those manually, which is a bit... "not springy".

Am I missing some part of the documentation, or should R2DBC dependency should spring-data-jpa should also be there and configured separately?

Draaksward
  • 759
  • 7
  • 32
  • r2dbc is a reactive jdbc replacement NOT a JPA replacement so yes you will need to do things manually or you can try the Spring Data R2DBC project. – M. Deinum Mar 17 '20 at 10:26
  • please read again. I am asking in terms of Spring (Data) R2DBC – Draaksward Mar 17 '20 at 10:30
  • Spring R2DBC != Spring Data R2DBC. Those are different things. The latter has auto mapping of results to dto's. Still entities aren't supported because JPA is JDBC based and blocking hence it doesn't support r2dbc. – M. Deinum Mar 17 '20 at 10:35
  • My mistake in the naming. As I understand, even Spring Data R2DBC will not provide entity creation (alittle side step from the non-blocking, but still), right? – Draaksward Mar 17 '20 at 10:40
  • As stated there is no such thing as entities in plain JDBC or R2DBC only dtos. Also what do you mean by entity creation? – M. Deinum Mar 17 '20 at 10:40
  • Table validation and creation on spring initialization. – Draaksward Mar 17 '20 at 10:41
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/209761/discussion-between-applebuckler-and-m-deinum). – Draaksward Mar 17 '20 at 10:42
  • It won't do that, as there is no metadata. You will need to manage the schema's yourself using flyway for instance. Which is also the recommended approach when using JPA (don't let hibernate or whatever you use create the schema!). – M. Deinum Mar 17 '20 at 10:43
  • Ok, thanks. Will follow this approach then. – Draaksward Mar 17 '20 at 10:44

0 Answers0