@MappedSuperclass
public abstract class Auction {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false)
private String title;
@Column
private String description;
@Column
private String category;
@Column(nullable = false)
private long sellerId;
@Column
private String urlPicture;
}
@Getter
@Setter
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "inverseauction")
public class InverseAuction extends Auction{
@Column(nullable = false)
private int startingPrice;
@Column(nullable = false)
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy'T'HH:mm:ss[.SSS][.SS][.S]")
private LocalDateTime expiryDate;
}
The only attributes my @GetMapping
returns are startingPrice
and expiryDate
, for some reason the Auction attributes are invisible to Auction.
My only guess is to add some SpringBoot Annotation but I don't know which one, I tried some but won't work
You need to add getters/setters to your MappedSuperClass and may have to create a custom AllArgsConstructor as Lombok doesn't do a super() in its generated AllArgsConstructor.