为了学校的目的,我正在使用基于 GWT 和 MapDB 的 Java Web 应用程序来实现数据持久性。由于我对 MapDB 不是很熟悉,所以我需要一些帮助。我的应用程序必须管理一个通过拍卖机制进行买卖的在线系统。注册用户可以销售产品并对其他用户销售的产品进行投标(或提问)。以下是我设计课程的方式:
拍卖类别:
public class Auction implements Serializable {
private int id; //unique id
private String seller; //the (unique) username of the seller
private String objName;
private String description;
private String category;
private Double startPrice;
private Date expDate;
private Boolean state; //closed or open
private Bid currentBid;
private String winner; //the user who wins
private Infos info; //questions and answers
信息类:
public class Infos implements Serializable {
private int id; //unique id
private String question;
private String answer;
投标类别:
public class Bid implements Serializable {
private String bidder; //username of the user who puts the bid
private Double bidPrice;
我以这种方式创建了数据库的文件:
DB db = DBMaker.newFileDB(new File(FILE_NAME)).closeOnJvmShutdown().make();
ConcurrentNavigableMap<Integer, Auction> auction= db.getTreeMap("auction");
现在我在想我做错了什么。拍卖可以有多个出价和多个问题(和答案)。此外,只有正在销售的用户才能回答有关该拍卖的问题。也许我必须删除竞标中的竞标字段并在竞标中插入一个竞标字段?拍卖是否有必要知道出价和信息是什么?