Revision from Predrag's feedback
This commit is contained in:
parent
413c02c078
commit
b424ae7ab2
@ -5,11 +5,15 @@ import javax.persistence.*;
|
||||
@Entity
|
||||
@Table(name = "Football_Player")
|
||||
public class FootballPlayer {
|
||||
@Id @GeneratedValue private long id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private long id;
|
||||
|
||||
@Column private String name;
|
||||
@Column
|
||||
private String name;
|
||||
|
||||
@Column private String team;
|
||||
@Column
|
||||
private String club;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
@ -27,15 +31,16 @@ public class FootballPlayer {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTeam() {
|
||||
return team;
|
||||
public String getClub() {
|
||||
return club;
|
||||
}
|
||||
|
||||
public void setTeam(String team) {
|
||||
this.team = team;
|
||||
public void setClub(String club) {
|
||||
this.club = club;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "FootballPlayer{" + "id=" + id + ", name='" + name + '\'' + ", team='" + team + '\'' + '}';
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FootballPlayer{" + "id=" + id + ", name='" + name + '\'' + ", club='" + club + '\'' + '}';
|
||||
}
|
||||
}
|
@ -97,6 +97,7 @@ public class HibernateLifecycleUnitTest {
|
||||
session.update(messi);
|
||||
transaction.commit();
|
||||
assertThat(getDirtyEntities()).size().isEqualTo(1);
|
||||
assertThat(getDirtyEntities().get(0).getName()).isEqualTo("Leo Messi");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,25 +2,25 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
||||
|
||||
create table Football_Player (
|
||||
id bigint not null,
|
||||
team varchar(255),
|
||||
club varchar(255),
|
||||
name varchar(255),
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
insert into
|
||||
Football_Player
|
||||
(team, name, id)
|
||||
(club, name, id)
|
||||
values
|
||||
('Juventus', 'Cristiano Ronaldo', next value for hibernate_sequence);
|
||||
|
||||
insert into
|
||||
Football_Player
|
||||
(team, name, id)
|
||||
(club, name, id)
|
||||
values
|
||||
('Barcelona', 'Lionel Messi', next value for hibernate_sequence);
|
||||
|
||||
insert into
|
||||
Football_Player
|
||||
(team, name, id)
|
||||
(club, name, id)
|
||||
values
|
||||
('PSG', 'Gigi Buffon', next value for hibernate_sequence);
|
Loading…
x
Reference in New Issue
Block a user