Hi,
I tried to use reverse engineering to generate domain objects from database schema.
Everything appear to be ok.
When I tried to insert a record in the table I find it is a problem. Because all fields in the table are defined not null and have default values. The problem is hibernate try to insert all fields whether I completed only a few. Because not all fields are initialised with default values hibernate put null in the fields not initialised. This result in error on insert operation. I resolved this issue by setting values to properties in generated POJO's.
The idea is I have hundreds of tables and I don't want to manually set default values for properties.
I have a question:
It is possible to set somehow reverse engineering to generate properties with default values taken from table definition?
Ex.
public class AaaProduse implements java.io.Serializable {
private String codProd;
private String denProd="";
private String sirGrupare="";
private String sirCautare="";
private BigDecimal stoc=0;
..............
instead of:
public class AaaProduse implements java.io.Serializable {
private String codProd;
private String denProd;
private String sirGrupare;
private String sirCautare;
private BigDecimal stoc;
Thank you very much,
Alex