EWA
Generator of Java code for Spring Boot + sql2o projects.
It auto generates, from a database table:
- Model
- Repository
- Service
- Aggregate
Features
findmethods have an optionalfields_to_ignoreparameter, 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_nullsoptional 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
findmethods. Update it and allfindmethods will be updated Servicemethods returns aAggregateobject, with the model as one of the attributesServicehas anenrich()stub method, for augmenting theAggregateandList<Aggregate>objects returned byServicemethodss. AllServicemethods 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
srcfolder - Copy
config_example.iniin 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, usepythoninstead 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