Hi people,
I wanted to show you a little utility I made and decided to publish on GitHub.
I work mainly with a legacy ERP with it's own database, and many times I need to create new records in tables. But in much cases, having to choose between map a 40+ fields table into one of my objects, with their own CRUD behaviour, or make raw SQL statements.
In the second case, one of my favourite strategies is to choose a model element of the table and build a SQL query like this one:
insert into TABLE
select Field1, Field2, Field3 from TABLE where Field1 = :Value
Having this SQL modified, replacing field names in the select with values:
insert into TABLE
select :NewId, 'New Value', Field3 from TABLE where Field1 = :Value
So here come this class, CopyMaker, wich allows you to:
1) Add String or Integer values informing wich field they override
2) Generate SQL for a specified table and a specified condition
I'm open to advice, improvements and anything on this.
Saludos,
Top comments (0)