Created
July 4, 2020 16:42
-
-
Save dsimonow/12cd583af5eead9fbbe0b74a07f798b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Data | |
public class StockOwned { | |
@JsonIgnore | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
long stockOwnedId; | |
@JsonIgnore | |
@OneToOne | |
@JoinColumn | |
Stock stockReference; | |
long amount; | |
public StockOwned(Stock stockReference, Long amount){ | |
this.stockReference = stockReference; | |
this.amount = amount; | |
} | |
public StockOwned(){ } | |
@JsonGetter("stockName") | |
protected String getStockName(){ | |
return stockReference.getName(); | |
} | |
@JsonGetter("stockSymbol") | |
protected String getStockSymbol(){ | |
return stockReference.getSymbol(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment