-
Notifications
You must be signed in to change notification settings - Fork 229
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
Mapping SQL to Abstract Class #318
Comments
@icu222much simpleflatmapper supports discriminator and support sql2o, unfortunately right now it's not possible to directly customised the SfmResultSetHandlerFactoryBuilder to add discriminator definition. just added a ticket to allow for that. arnaudroger/SimpleFlatMapper#608 |
@arnaudroger Great, thank you. |
@icu222much pushed 3.2.0 of sfm-sql2o , I put an example in the release notes |
@arnaudroger thank you! |
My project is using the hexagonal architecture and I am wondering if I can use sql2o custom converters (https://github.com/aaberg/sql2o/wiki/Implementing-and-using-custom-converters) to determine which Adapter sql2o should be mapped to.
Would it be possible use sql2o custom converters (https://github.com/aaberg/sql2o/wiki/Implementing-and-using-custom-converters) to map to an abstracted class based on the result from the database? So for example, I have the abstract class Device, and two classes that implements Device (ElectricDevice, SolarDevice). Device has the property 'type' specifying if it is electric or solar. Would it be possible to write a sql2o custom converter that can read the response from the fetch, and then determine whether to create an ElectricDevice object or SolarDevice object based off the database fetch?
I have tried following the instructions on the custom converter page (https://github.com/aaberg/sql2o/wiki/Implementing-and-using-custom-converters) but the custom converter code I wrote never got executed. Is this custom converter used for converting values and cannot be used for determine which class sql2o maps the sql response into?
The text was updated successfully, but these errors were encountered: