Skip to content

Instantly share code, notes, and snippets.

@dsimonow
Created July 4, 2020 16:42
Show Gist options
  • Save dsimonow/12cd583af5eead9fbbe0b74a07f798b8 to your computer and use it in GitHub Desktop.
Save dsimonow/12cd583af5eead9fbbe0b74a07f798b8 to your computer and use it in GitHub Desktop.
@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