Skip to content

Commit 7870a7e

Browse files
committed
spring-projects#278 - Fix entity characteristics in Customer in Eclipselink example.
We now calculate the equals(…) and hashCode() methods by looking at the indentifier only. Removed default constructor in favor of Lombok's @NoArgConstructor.
1 parent aa2c2e1 commit 7870a7e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015 the original author or authors.
2+
* Copyright 2015-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,26 +15,26 @@
1515
*/
1616
package example.springdata.jpa.eclipselink;
1717

18+
import lombok.AccessLevel;
19+
import lombok.Data;
20+
import lombok.EqualsAndHashCode;
21+
import lombok.NoArgsConstructor;
22+
import lombok.RequiredArgsConstructor;
23+
1824
import javax.persistence.Entity;
1925
import javax.persistence.GeneratedValue;
2026
import javax.persistence.Id;
2127

22-
import lombok.Data;
23-
import lombok.RequiredArgsConstructor;
24-
2528
/**
2629
* @author Oliver Gierke
2730
*/
2831
@Data
2932
@Entity
33+
@EqualsAndHashCode(of = "id")
3034
@RequiredArgsConstructor
35+
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
3136
public class Customer {
3237

3338
private @Id @GeneratedValue Long id;
3439
private final String firstname, lastname;
35-
36-
Customer() {
37-
this.firstname = null;
38-
this.lastname = null;
39-
}
4040
}

0 commit comments

Comments
 (0)