0

私は休止状態が初めてで、注釈を使用しています

これらは私の2つのテーブルです:

ここに画像の説明を入力

これが私のテーブル「ペルソナ」です

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

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "codigo", unique = true, nullable = false)
    private int codigo;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "codTipoIdent", nullable = false)
    private TipoIdentificacion tipoIdentificacion;

    ....

これは私の 2 番目のテーブル「TipoIdentificacion」です。

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

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "codigo", unique = true, nullable = false)
    private int codigo;

    @Column(name = "nombre", nullable = false)
    private String nombre;

    @Column(name = "siglas", nullable = false)
    private String siglas;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "tipoIdentificacion")    
    private Set<Persona> persona = new HashSet<Persona>(0);

"Persona" の主キーは "codigo" で、"TipoIdentificacion" の場合は "codigo" で、ペルソナ (codTipoIdent) からの FK です。

すべてがうまく見えます。また、Webアプリでクラッドを作成しましたが、「TipoIdentificacion」のリストをリクエストするためにデバッグすると、次のようになります

ここに画像の説明を入力

それはループを作ります、なぜですか?

4

0 に答える 0