Comment générer des objets de domaine avec des annotations de l'utilisation d'hibernate tools

J'utilise Eclipse, Hibernate Outils pour créer des classes de domaine à partir de ma base de données et le besoin d'ajouter des annotations JPA.

Est-il un moyen d'ajouter des annotations? Éventuellement avec reveng.xml et la rétro-Ingénierie? Comment cela doit-il être fait?

Généré de domaine de code:

public class Country implements java.io.Serializable {

    private long id;
    private String description;
    private String identifier;
    private String futureuse;
    private Set accounts = new HashSet(0);

    public Country() {
    }

    public Country(long id, String description, String identifier) {
        this.id = id;
        this.description = description;
        this.identifier = identifier;
    }
    ...

Besoin de code:

@Entity
@Table(name = "COUNTRY")
public class Country implements java.io.Serializable {

    @Id
    @Column(name="CNTR_ID")
    private Long id;
    @Column(name="CNTR_FUTUREUSE")
    private String futureUse;
    @Column(name="CNTR_IDENTIFIER")
    private String identifier;
    @Column(name="CNTR_DESCRIPTION")
    private String description;
    private Set accounts = new HashSet(0);

    public Country() {
    }

    public Country(long id, String description, String identifier) {
        this.id = id;
        this.description = description;
        this.identifier = identifier;
    }
        ...

OriginalL'auteur Dimitri Dewaele | 2013-07-26