-
Notifications
You must be signed in to change notification settings - Fork 132
Add support for embedded entities #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We don’t support embeddables yet. It would make sense to add support for these. |
Looking at the Converter<Row, T> implementation I don't see a good spot for the converter to be column-aware. Perhaps this kind of logic would be most appropriate in the ResultProcessor? At the moment, my workaround is to keep my "entities" (Really, data bags given the lack of rich behavior / complex mapping support) as flat as possible and then have a separate DTO w/ a static factory method to enrich the output of REST API's output w/ the upstream flat objects pre-assembled into their richer structure as part of a pipeline for final output. This feels very brittle and sub-optimal in terms of building a sane business process, but I guess that's the current state of things. I'd definitely like to see some kind of embeddable mapping in-place so less data transformation steps need to be managed by the end-programmer. Definitely looking forward to some opinions / a direction or perhaps a better workaround than I'm doing. Thanks for the great repo, I know this is a lot of work to build and we're not quite at 1.0.0 =) |
The Following the embeddable idea, you can represent nested objects in a flat row by using columns with prefixes. That's how Spring Data JDBC provides Embedded entity support requires a read- and a write-part to properly work. Adding this kind of functionality requires a lot of decoration if that aspect is handled outside of the Spring Data R2DBC bits. Likely, we will have to extend |
The official document includes an embedded example( |
Hello. Recently, I had to deal with embedded entities in the context of applying DDD principles. I wanted to store value objects in entity tables, and I solved it by implementing WritingConverter and ReadingConverter. Is interesting that while using webflux, we still have the annotation org.springframework.data.relational.core.mapping.Embedded, but the Embeddable does not exist. I do not see the purpose of Embedded as standalone. |
Greetings, I ran into the same problem with embedded, you can get around it with the help of converters, but I want to know if support is planned in the near future or will it not be? |
In general, we want to support embeddables with R2DBC, however, we are currently busy with other things. |
When can |
hi~ how to work around by acheive WritingConverter and ReadingConverter? could you please give me some examples? thanx! |
I'm looking at implementing a read and write converters for an embedded object in a row that may exist in two forms.
The specific example is a MonetaryAmount that contains two fields (amount, currency code) in order to properly generate a Monetary Amount. The parent object's row contains two instances of this object differed by its prefix (e.g., MSRP, and say Shipping Cost, could be more but just for keeping things simple in this issue, let's assume that there are two instances of this type in the row). Is there a way to annotate an object similar to how JPA supports embeddables w/ a prefix declaration w/ a converter to distinguish the fields?
Sample Entity:
The text was updated successfully, but these errors were encountered: