File tree Expand file tree Collapse file tree
java/ru/javawebinar/topjava Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package ru .javawebinar .topjava ;
2+
3+ import javax .validation .groups .Default ;
4+
5+ public class View {
6+ public interface Persist extends Default {}
7+ }
Original file line number Diff line number Diff line change 55import org .hibernate .annotations .OnDeleteAction ;
66import org .hibernate .validator .constraints .Range ;
77import org .springframework .format .annotation .DateTimeFormat ;
8+ import ru .javawebinar .topjava .View ;
89import ru .javawebinar .topjava .util .DateTimeUtil ;
910
1011import javax .persistence .*;
@@ -51,7 +52,7 @@ public class Meal extends AbstractBaseEntity {
5152 @ JoinColumn (name = "user_id" , nullable = false )
5253 @ OnDelete (action = OnDeleteAction .CASCADE )
5354 @ JsonBackReference
54- // @NotNull
55+ @ NotNull ( groups = View . Persist . class )
5556 private User user ;
5657
5758 public Meal () {
Original file line number Diff line number Diff line change 9393 <entry key =" #{T(org.hibernate.cache.jcache.ConfigSettings).PROVIDER}" value =" org.ehcache.jsr107.EhcacheCachingProvider" />
9494 <entry key =" #{T(org.hibernate.cfg.AvailableSettings).USE_SECOND_LEVEL_CACHE}" value =" true" />
9595 <entry key =" #{T(org.hibernate.cfg.AvailableSettings).USE_QUERY_CACHE}" value =" false" /> <!-- default-->
96+
97+ <entry key =" javax.persistence.validation.group.pre-persist" value =" ru.javawebinar.topjava.View$Persist" />
98+ <entry key =" javax.persistence.validation.group.pre-update" value =" ru.javawebinar.topjava.View$Persist" />
9699<!--
97100 <entry key="#{T(org.hibernate.cfg.AvailableSettings).HBM2DDL_SCRIPTS_ACTION}" value="drop-and-create"/>
98101 <entry key="#{T(org.hibernate.cfg.AvailableSettings).HBM2DDL_SCRIPTS_CREATE_TARGET}" value="${TOPJAVA_ROOT}/config/ddl/create.ddl"/>
You can’t perform that action at this time.
0 commit comments