Home How to use the Hibernate Join Column?
Reply: 0

How to use the Hibernate Join Column?

user776
1#
user776 Published in April 26, 2018, 7:53 am

I have two classes and relations between them. Can`t understand where the problem is. I write code in the next way.

 public class Abiturient {

        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name = "id", nullable = false, unique = true, length = 11)
        private Long id;

        @ManyToOne(fetch = FetchType.LAZY)
        @JoinColumn(name = "prizv_id")
        private Prisvishche abiturients_pr;

And mapped one:

public class Prisvishche {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column
    private BigInteger prizv_id;

    @OneToMany(mappedBy = "prizv_id")
    private List<Abiturient> abiturients = new ArrayList();
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306181 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO