this is my circuit generation code:
Schema schema = new Schema(VERSION, "com.example.dao");
Entity player = schema.addEntity("Player");
Property playerIdProperty = player.addStringProperty("id").primaryKey().getProperty();
player.addStringProperty("name").notNull();
player.addStringProperty("created_at");
player.addStringProperty("updated_at");
Entity match = schema.addEntity("Match");
match.addStringProperty("id").primaryKey();
match.addIntProperty("score1");
match.addIntProperty("score2");
match.addStringProperty("created_at");
match.addStringProperty("updated_at");
match.addToOne(player, playerIdProperty, "dp1");
match.addToOne(player, playerIdProperty, "dp2");
match.addToOne(player, playerIdProperty, "op1");
match.addToOne(player, playerIdProperty, "op2");
new DaoGenerator().generateAll(schema, "app/src-gen");
And here is what it generates:
public class MatchDao extends AbstractDao<Match, String> {
public static final String TABLENAME = "MATCH";
public static class Properties {
public final static Property Id = new Property(0, String.class, "id", true, "ID");
public final static Property Score1 = new Property(1, Integer.class, "score1", false, "SCORE1");
public final static Property Score2 = new Property(2, Integer.class, "score2", false, "SCORE2");
public final static Property Created_at = new Property(3, String.class, "created_at", false, "CREATED_AT");
public final static Property Updated_at = new Property(4, String.class, "updated_at", false, "UPDATED_AT");
public final static Property Id = new Property(5, String.class, "id", true, "ID");
};
As you can see, there are two properties in MatchDao called "Id". I need to create two tables with primary keys, which are rows (a row is a requirement of a remote db) and 4 foreign keys (there are 4 players in each match).
Question: why is the "Id" property duplicated and how to avoid it? thanks in advance