File tree Expand file tree Collapse file tree 3 files changed +97
-0
lines changed
src/main/java/com/hsbc/simpleapi Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .hsbc .simpleapi .dao ;
2+
3+ import org .springframework .data .repository .CrudRepository ;
4+
5+ import com .hsbc .simpleapi .model .Customer ;
6+
7+ public interface CustomerRepository extends CrudRepository <Customer , Long > {
8+
9+ }
Original file line number Diff line number Diff line change 1+ package com .hsbc .simpleapi .model ;
2+
3+ import javax .persistence .Embeddable ;
4+
5+ @ Embeddable
6+ public class Address {
7+
8+ private String city ;
9+ private String street ;
10+ private String zipCode ;
11+
12+ public String getCity () {
13+ return city ;
14+ }
15+
16+ public void setCity (String city ) {
17+ this .city = city ;
18+ }
19+
20+ public String getStreet () {
21+ return street ;
22+ }
23+
24+ public void setStreet (String street ) {
25+ this .street = street ;
26+ }
27+
28+ public String getZipCode () {
29+ return zipCode ;
30+ }
31+
32+ public void setZipCode (String zipCode ) {
33+ this .zipCode = zipCode ;
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ package com .hsbc .simpleapi .model ;
2+
3+ import javax .persistence .Column ;
4+ import javax .persistence .Embedded ;
5+ import javax .persistence .Entity ;
6+ import javax .persistence .GeneratedValue ;
7+ import javax .persistence .GenerationType ;
8+ import javax .persistence .Id ;
9+ import javax .persistence .Table ;
10+
11+ import javax .validation .constraints .NotNull ;
12+
13+ @ Entity
14+ @ Table (name = "customers" )
15+ public class Customer {
16+
17+ @ Id
18+ @ GeneratedValue (strategy = GenerationType .IDENTITY )
19+ @ Column
20+ private long id ;
21+
22+ @ Column
23+ @ NotNull
24+ private String name ;
25+
26+ @ Embedded
27+ @ Column
28+ private Address address ;
29+
30+ public long getId () {
31+ return id ;
32+ }
33+
34+ public void setId (long id ) {
35+ this .id = id ;
36+ }
37+
38+ public String getName () {
39+ return name ;
40+ }
41+
42+ public void setName (String name ) {
43+ this .name = name ;
44+ }
45+
46+ public Address getAddress () {
47+ return address ;
48+ }
49+
50+ public void setAddress (Address address ) {
51+ this .address = address ;
52+ }
53+ }
You can’t perform that action at this time.
0 commit comments