EWA
Generator of Java code for Spring Boot + sql2o projects.
It auto generates, from a database table:
- Model
- Repository
- Service
- Aggregate
Features
find
methods have an optionalfields_to_ignore
parameter, to filter fields in SELECTs- All methods are overloaded with a method with transaction and a method without transaction, if you don’t need it
- Method
findByModel()
, to SELECT from database matching fields populated in model. No need to createfindBySomefield()
- Similar method
deleteByModel()
save()
method, that first checks for row existance, and then callinsert()
orupdate()
exclude_nulls
optional parameter forupdate()
, that does not update fields that are nulls- Support for tables with primary key with multiple fields
- Basic SELECT sql, centralized for all
find
methods. Update it and allfind
methods will be updated Service
methods returns aAggregate
object, with the model as one of the attributesService
has anenrich()
stub method, for augmenting theAggregate
andList<Aggregate>
objects returned byService
methodss. AllService
methods created by EWA callsenrich()
by default.- SELECT methods prefix is configurable. You can use “find”, “get”, “givePapa” or whatever you want
- Configurable indentation style
Install
See INSTALL.TXT
. You can download the program at Releases.
Use
- Open a cmd or a shell
- Go to the folder where you extracted EWA
- Go to
src
folder - Copy
config_example.ini
in another .ini file, and edit it following its comments - If you have Linux, you have to source
oracle_env.sh
. See ORACLE.txt for more details - Launch in the shell:
> python3 ewa.py --config YOUR_CONFIG.ini
. If you have Windows, usepython
instead ofpython3
- Read and follow the instructions at the end of script launching
Tested databases
Oracle 12C+, MSSQL 2012+. Not all field types are currently supported. Please open an issue if you want me to add one.
Untested, but potentially working databases
I’m using sqlalchemy
, so in teory I can support any database that it supports. If you want to add a database, please open an issue.
License
See LICENSE