jhipsterjdl

Entity relations JDL-Studio


I´m creating a project in jhipster and I need to access to this metrics and structure:

Structure:

Of the players we want to save:

Secondly, we must create the necessary structure to host the games. For each game played we want to save:

Metrics:

My problem is that the list of players to match with the list of winner and losers and right now this is not happening. The is a list of players with nickname etc and a different one not related of winners and losers.

How can I create the relationship in this case?

This is my code so far in JDL-Studio. It doesn´t work.

entity Player {
    nickname String unique pattern(/[a-zA-Z0-9_]+/),
    name String,
    surname String,
    dateOfBirth LocalDate
}

entity Game {
    winnerPoints Integer,
    loser String,
    winner String,
    game String
}

relationship ManyToMany {
    Game{player(nickname)} to Player{game}
}

Relationship Jhipster


Solution

  • Winner and loser should not be strings, they should be 2 relationships to Player. Also it seems strange that Game entity has a game field, either the entity is badly named or it's the field.

    entity Player {
        nickname String unique pattern(/[a-zA-Z0-9_]+/),
        name String,
        surname String,
        dateOfBirth LocalDate
    }
    
    entity Game {
        winnerPoints Integer,
        game String
    }
    
    relationship ManyToOne {
        Game{winner(nickname)} to Player,
        Game{loser(nickname)} to Player
    }