marco-sulla / ewa Goto Github PK
View Code? Open in Web Editor NEWGenerator of Model, Repository and Service for Spring Boot + sql2o
Home Page: https://marco-sulla.github.io/ewa/
License: GNU General Public License v3.0
Generator of Model, Repository and Service for Spring Boot + sql2o
Home Page: https://marco-sulla.github.io/ewa/
License: GNU General Public License v3.0
Only if aaberg/sql2o#330 will be accepted.
in config.ini
case_sensitive = 1|0
if case sensitive, no lower() to attribute names
To Services, add an optional Connection parameter to the enrich()
method.
Adds also the possibility to pass null
as Connection parameter to Repository method. If null
, method without Connection parameter is called.
Methods in repo with a parameter Connection
should be allowed to get a null
. If null
, the corresponding method without the Connection
parameter should be invoked.
Repository code generated with :
Steps to reproduce:
You can find the generated code here invitoRegistrazione.zip
The repository tries to return the inserted primary key (Long) but a cast to BigDecimal throws an exception executing res_true = ((BigDecimal) res).longValue();
Code under investigation :
final Object res = Sql2oUtility.getInsertedId("INVITO_REGISTRAZIONE", "IUDINVITOREGISTRAZIONE", con, key, Long.class);
Object res_true;
final Class<?> klass = Long.class;
if (res != null && (klass == Long.class || klass == BigDecimal.class)) {
res_true = ((BigDecimal) res).longValue();
}
else {
res_true = res;
}
### Thanks from Niuma Epp Team
Enjoy!
Even if the code is auto-generated, is cumbersome that the same code is copy-pasted very much time.
I think it's better to implement a AbstractRepository
and an Repository
interface, that shares the common code to all repositories created with EWA. This abstract and interfacecan be useful also to people that do NOT want to use EWA. The same think should be done also for services.
For this reason, the findByNameOfUniqueId()
must be renamed simply findById()
. This also improves abstraction and encapsulation. Interface for models and aggregators should also be implemented.
PS: are specific interfaces for repo and services really needed? Evaluate to eliminate them.
The install instructions are really difficult. I think that:
setup.py
should be createdThis way, installing EWA will be simply pip install ewa
.
PS: obligatory requirement of mssql
and cx_Oracle
in code must be removed. The code that requires these libraries must be loaded only if the .ini
file requires that database. There's no need to impose the user to install all the supported drivers.
PPS: instructions to how to install the absurdly compicated cx_Oracle
driver should remain.
public Query createQuery(String queryText, String ... columnNames) {
try {
if (jdbcConnection.isClosed()) {
createConnection();
}
} catch(SQLException e) {
throw new Sql2oException("Error creating connection", e);
}
return new Query(this, queryText, columnNames);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.