Using the Save command from the Spring data

0

When using the save of Spring Data command to insert it into the table, am I required to annotate all fields in the template class with anotation @Column ?

  

If the fields I did not enter accept null, it would save the fields   remaining as null?

  

If the fields I did not write do not accept nulls, it will not   to work?

    
asked by anonymous 03.01.2018 / 14:44

1 answer

1

You do not necessarily have to write down all your attributes with @Column .

If you choose not to annotate the application it will adopt the attribute name pattern as the column name in the database and if the attribute is an object type (eg Integer, Boolean) it will accept null normally. If you use primitive (int, boolean) you will need to ensure that these values are populated before performing persistence.

In English OS you have an interesting answer regarding the use of objects or primitive type. See if you help with decision making: Which one to use, int or Integer

    
03.01.2018 / 14:55