#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.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,26 +15,26 @@
|
||||
*/
|
||||
package example.springdata.jpa.eclipselink;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@EqualsAndHashCode(of = "id")
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
|
||||
public class Customer {
|
||||
|
||||
private @Id @GeneratedValue Long id;
|
||||
private final String firstname, lastname;
|
||||
|
||||
Customer() {
|
||||
this.firstname = null;
|
||||
this.lastname = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user