File tree Expand file tree Collapse file tree
src/main/java/com/devnexus/ting/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .devnexus .ting .core .dao ;
22
33import com .devnexus .ting .core .model .registration .EventSignup ;
4+ import org .springframework .stereotype .Repository ;
45
5- public interface EventSignupDao {
6+ public interface EventSignupDao extends GenericDao < EventSignup , Long > {
67
7- EventSignup getByEventKey (Long eventId );
8+ EventSignup getByEventKey (String eventKey );
89
910
1011}
Original file line number Diff line number Diff line change 1717
1818import com .devnexus .ting .core .dao .EventSignupDao ;
1919import com .devnexus .ting .core .model .registration .EventSignup ;
20+ import org .springframework .stereotype .Repository ;
2021
22+ @ Repository ("eventSignupDao" )
2123public class EventSignupDaoJpa extends GenericDaoJpa < EventSignup , Long >
2224 implements EventSignupDao {
2325
24- public EventSignupDaoJpa (Class < EventSignup > persistentClass ) {
26+ public EventSignupDaoJpa () {
2527 super (EventSignup .class );
2628 }
2729
2830 @ Override
29- public EventSignup getByEventKey (Long eventId ) {
31+ public EventSignup getByEventKey (String eventKey ) {
3032 return super .entityManager .createQuery ("select es from EventSignup es "
3133 + " join es.event e "
32- + "where e.id = :eventKey" , EventSignup .class )
33- .setParameter ("eventKey" , eventId )
34+ + "where e.eventKey = :eventKey" , EventSignup .class )
35+ .setParameter ("eventKey" , eventKey )
3436 .getSingleResult ();
3537 }
3638
Original file line number Diff line number Diff line change 55import java .util .HashSet ;
66import java .util .Set ;
77import javax .persistence .Cacheable ;
8+ import javax .persistence .CascadeType ;
89import javax .persistence .Entity ;
910import javax .persistence .ManyToMany ;
1011import javax .persistence .ManyToOne ;
2324@ XmlAccessorType (XmlAccessType .FIELD )
2425public class EventSignup extends BaseModelObject {
2526
26- @ ManyToMany
27+ @ ManyToMany ( cascade = CascadeType . ALL )
2728 private Set <PurchaseGroup > groups = new HashSet <>();
2829
2930 @ ManyToOne
Original file line number Diff line number Diff line change 55import java .util .HashSet ;
66import java .util .Set ;
77import javax .persistence .Cacheable ;
8+ import javax .persistence .CascadeType ;
89import javax .persistence .Entity ;
910import javax .persistence .ManyToMany ;
1011import javax .persistence .ManyToOne ;
1617import javax .xml .bind .annotation .XmlTransient ;
1718import org .hibernate .annotations .Cache ;
1819import org .hibernate .annotations .CacheConcurrencyStrategy ;
20+ import org .hibernate .annotations .Cascade ;
1921import org .hibernate .validator .constraints .NotEmpty ;
2022
2123/**
3032@ XmlAccessorType (XmlAccessType .FIELD )
3133public class PurchaseGroup extends BaseModelObject {
3234
33- @ ManyToMany
35+ @ ManyToMany ( cascade = CascadeType . ALL )
3436 private Set <PurchaseItem > items = new HashSet <>();
3537
3638 @ ManyToOne
@@ -44,7 +46,6 @@ public class PurchaseGroup extends BaseModelObject {
4446 protected String label ;
4547
4648 @ ManyToOne
47- @ NotNull
4849 @ XmlTransient
4950 protected EventSignup eventSignup ;
5051
Original file line number Diff line number Diff line change 2727public class PurchaseItem extends BaseModelObject {
2828
2929 @ ManyToOne
30- @ NotNull
3130 @ XmlTransient
3231 private PurchaseGroup purchaseGroup ;
3332
@@ -44,7 +43,7 @@ public class PurchaseItem extends BaseModelObject {
4443 @ Size (max = 255 )
4544 private String value ;
4645
47- @ NotEmpty
46+ @ NotNull
4847 private BigDecimal price ;
4948
5049 @ Temporal (TemporalType .DATE )
You can’t perform that action at this time.
0 commit comments