0
我對如何從getter和setter傳遞的值有點困惑。我如何從其他課程獲得價值?
這裏我有2類
賣家和合同,我想通過seller.symbol價值爲合同
賣家
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import java.util.Date;
import java.util.List;
@Entity(value = "S", noClassnameStored = true)
public class Seller {
@Id
private ObjectId id;
private String symbol;
private String clearingVenue;
private String description;
private String address;
private String city;
private String term;
private String state;
private String zipCode;
private String country;
private boolean showUser;
... getter和二傳手
合同
package dao.contract;
import dao.seller.Seller;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import requests.CreateSellerRequest;
import requests.UpdateSellerRequest;
import java.util.Date;
import java.util.List;
@Entity(value = "contracts", noClassnameStored = true)
public class Contract {
@Id
private ObjectId id;
private String symbol;
private String description;
private int size;
private String delivery;
private String contractName;
private double volumeInc;
private String facility;
private boolean showUser;
private String seller;
private Seller sellers;
這樣做的最佳方法是什麼?我應該在合同中調用getter,如「賣家object.symbol」 我想將符號值傳遞給Contract:String seller。 這裏連接2個表的值最好的方法是什麼?
我需要一些建議。不知道如何解決這個問題。
感謝
需要一些想法?任何評論將有助於......謝謝 – Fenici