You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ℹ️ This branch is a rework with breaking changes to refactor models and related classes to eliminate having to specify identifier quoting in the model by creating the model for a database session. Which makes sense for a database model class.
Biggest change is that the model now takes two template arguments: main model class and its associated data class with an optional session instance and identifier quoting string.
If session is not given or null then default session will be used.
If quote if not given or null then the connection metaData.identifierQuoteString will be used, anything else will use whatever string is passed in. Unless your jdbc driver does not provide identifier quoting, there is no need to use anything but the default.
Companion object now only has the table name constant string.
All other functions implemented in the Model with two abstract members: toData() returning the data class for the model and operator invoke for the factory function for the model. To get another instance of a model myModel invoke the model instance as a function myModel().
For models that do not need a data class ModelNoData is also available which only takes a single template argument, as was the case for the Model class in previous releases.
Having the session instance information in the model simplifies using models because session no longer has to be specified for every method performing database access.
Additionally, list results are simplified because neither the session nor the extractor needs to be passed, with myModel.listData() variations can be used or myModel.listModel() variations.
Additionally there is now an alias:String? = null argument available for sql generating functions which will add a table alias to the table name and use the alias for disambiguating column names. If generating queries with multiple tables, set the alias to empty string "" or the table name to have it added to the column references. An empty table alias or one equal to the table name will only be used for column references.
ℹ️ This branch is a rework with breaking changes to refactor models and related classes to eliminate having to specify identifier quoting in the model by creating the model for a database session. Which makes sense for a database model class.
Biggest change is that the model now takes two template arguments: main model class and its associated data class with an optional session instance and identifier quoting string.
If
session
is not given ornull
then default session will be used.If
quote
if not given ornull
then the connectionmetaData.identifierQuoteString
will be used, anything else will use whatever string is passed in. Unless your jdbc driver does not provide identifier quoting, there is no need to use anything but the default.Companion object now only has the table name constant string.
All other functions implemented in the
Model
with two abstract members:toData()
returning the data class for the model andoperator invoke
for the factory function for the model. To get another instance of a modelmyModel
invoke the model instance as a functionmyModel()
.For models that do not need a data class
ModelNoData
is also available which only takes a single template argument, as was the case for theModel
class in previous releases.Having the session instance information in the model simplifies using models because session no longer has to be specified for every method performing database access.
Additionally, list results are simplified because neither the session nor the extractor needs to be passed, with
myModel.listData()
variations can be used ormyModel.listModel()
variations.Additionally there is now an
alias:String? = null
argument available for sql generating functions which will add a table alias to the table name and use the alias for disambiguating column names. If generating queries with multiple tables, set thealias
to empty string""
or the table name to have it added to the column references. An empty table alias or one equal to the table name will only be used for column references.Generate Kotlin-Model.groovy
has been updated to generate the new model format from tables in the database.The text was updated successfully, but these errors were encountered: