Java

JPA relationships (@OneToMany, @ManyToOne)

Në shqip: Lidhjet në JPA

ShpjegimiSQ

Në JPA, lidhjet mes tabelave shkruhen me anotacione: @ManyToOne (shumë nxënës në një klasë), @OneToMany (një klasë ka shumë nxënës), @ManyToMany. Hibernate-i i kthen në çelësa të huaj.

EnglishEN

In JPA, links between tables are written with annotations: @ManyToOne (many students in one class), @OneToMany (a class has many students), @ManyToMany. Hibernate turns them into foreign keys.

Si ta mendosh

Si pema familjare me vija mes njerëzve.

Lexoje në anglisht

Like a family tree with lines between people.

Shembull kodijava

@Entity class Nxenes {
    @Id @GeneratedValue Long id;
    @ManyToOne Klasa klasa;
}

Terma të lidhur