-
Notifications
You must be signed in to change notification settings - Fork 212
General Insert Statement #201
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
Hello, for our internal project after we did decide to leave JPA and use more flexible framework. First option was Exposed, but a lot of open bugs, zero doc + not released version discouraged me. So I did found mybatis-dynamic-sql which we now use with Kotlin, but I did wrap dynamic sql builders with Kotlin DSL lib which use mybatis-dynamic-dql as sql enerator + NamedParameterJdbcTemplate as executor. I have changed a lot of features, because my goal was to go without annotations, xml files, reflection + be Kotlin friendly. So in the end I have lib, which is Exposed like, with not null and nullable columns, enhanced where dsl, insert dsl, update dsl, 'smart collumns' which provide support for mapping values from and to db using interface similiar to mybatis TypeHandler, but not taken from mybatis, because I do not need whole mybatis as dependency. In few weeks I should be possible post this code to github and maybe some changes may be incorporated. here is sample dls for kotlin insert DSL which I have created, because Not it is type safe provided value type must eq to collumn type including nullability, which is not shown in example. Today I have added possibility to map enum to any type so this example may be little deprecated, but may work as inspiration.
usage
it took some time, but in the end mapping without string path to getter or annotations work like this
and dynamic sql lib does not need to know entity type only map of values |
Thanks for posting - this is interesting to me. My idea is to build an insert statement that would not need your |
Provide a general insert statement that is not based on a POJO class. The current insert statements assume that a class exists that holds field data for insert statements. This works well for retrieving generated keys with MyBatis, but is unnecessary for Spring. If we allow a general INSERT like we do with UPDATE, we can also easily implement something like type handlers for Spring (like #131).
The text was updated successfully, but these errors were encountered: