Skip to content

Commit 08aa917

Browse files
committed
Synched with Local
1 parent 554df11 commit 08aa917

2 files changed

Lines changed: 21 additions & 23 deletions

File tree

‎spring-jpa/src/main/java/org/baeldung/persistence/model/Bar.java‎

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.baeldung.persistence.model;
22

33
import java.io.Serializable;
4-
54
import javax.persistence.Column;
65
import javax.persistence.Entity;
76
import javax.persistence.GeneratedValue;
@@ -12,51 +11,51 @@
1211
@Entity
1312
public class Bar implements Serializable {
1413

14+
private static final long serialVersionUID = 1L;
15+
1516
@Id
1617
@GeneratedValue(strategy = GenerationType.AUTO)
17-
private long id;
18-
19-
@Column(nullable = false)
20-
private String name;
18+
private int id;
2119

2220
@OneToMany(mappedBy = "bar", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
2321
@OrderBy("name ASC")
2422
List<Foo> fooList;
2523

26-
public Bar() {
24+
private String name;
25+
26+
public Bar(){
2727
super();
2828
}
2929

30-
public Bar(final String name) {
30+
public Bar(final String name){
3131
super();
32-
3332
this.name = name;
3433
}
34+
35+
//API
3536

36-
// API
37-
38-
public long getId() {
39-
return id;
37+
public List<Foo> getFooList() {
38+
return fooList;
4039
}
4140

42-
public void setId(final long id) {
43-
this.id = id;
41+
public void setFooList(List<Foo> fooList) {
42+
this.fooList = fooList;
4443
}
4544

46-
public String getName() {
47-
return name;
45+
public int getId() {
46+
return this.id;
4847
}
4948

50-
public void setName(final String name) {
51-
this.name = name;
49+
public void setId(int id) {
50+
this.id = id;
5251
}
5352

54-
public List<Foo> getFooList() {
55-
return fooList;
53+
public String getName() {
54+
return this.name;
5655
}
5756

58-
public void setFooList(final List<Foo> fooList) {
59-
this.fooList = fooList;
57+
public void setName(String name) {
58+
this.name = name;
6059
}
6160

6261
//

‎spring-jpa/src/main/java/org/baeldung/persistence/model/Foo.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.baeldung.persistence.model;
22

33
import java.io.Serializable;
4-
54
import javax.persistence.Column;
65
import javax.persistence.Entity;
76
import javax.persistence.GeneratedValue;

0 commit comments

Comments
 (0)