In my project based on spring-data-rest I have some classes annotated with the @Entity annotation.
@Entity @Table(name = "my_table) @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class MyTable extends BaseTableEntity { private String name; private String description; } Now I am not quite sure as to how Spring handles creation of new instances of classes annotated with that annotation. I needed to create an object of such an Entity class making sure that no database operations takes place.
To make it clear, say I do MyTable table = new MyTable() in a POJO class. Can I be sure that Spring with the help of Hibernate/JPA won't create records in my database. What if I do the same in a @Component class instead of a POJO.
@Tableannotation since I want to manage automatic table creation for these entities. Its just that sometimes I want to create a POJO from the same annotated class without bothering about the database.MyTableRepository.save(table), thetableobject won't be monitored by Spring for updates and stuff.