Menu

JoinTable annotation mandatory

schifazl
2013-11-04
2013-11-05
  • schifazl

    schifazl - 2013-11-04

    When generating PrimeFaces Pages from Entity Classes no many to many relationships were generated until I noticed in your videos that you were using the @JoinTable annotation. I prefer to avoid too many redundant annotations, both for code readability and for avoiding mistakes. It would be nice if PrimeFaces CRUD would get this info without the @JoinTable annotation and just with the @ManyToMany annotation.

    Thanks and keep up the good work! :)

     
  • Kay Wrobel

    Kay Wrobel - 2013-11-04

    Hi Schifazl. You are referring to the Entity classes, which are generated separately from the CRUD pages using NetBeans' Entity Classes from Database wizard. I am also using NetBeans' internal API to make some determinations about such entities. So I am tied to whatever NetBeans does.

     

    Last edit: Kay Wrobel 2013-11-04
  • schifazl

    schifazl - 2013-11-04

    OK, never mind :)

     
  • Kay Wrobel

    Kay Wrobel - 2013-11-04

    I just found out that during entity generation, if you click on the check box for "Use defaults where possible", the @JoinColumn annotation doesn't get generated. Try it out.

     
  • Kay Wrobel

    Kay Wrobel - 2013-11-04

    Scratch that! @JoinTable still gets generated. Though I think that NetBeans put it inside the wrong class. In my case, NetBeans put the JoinTable annotation inside the Characteristic class and not inside the Customer class. That is a problem because now, the CRUD generator puts selection list on the Characteristic screens (Create,Edit). That is not where I think they should belong. They should be on the Customer entity. Wouldn't you agree?

     
  • schifazl

    schifazl - 2013-11-05

    Yes, they should be in the Customer entity, but I'm not generating Entities from DB schema, but the other way around. So in my case this isn't an issue because I'm choosing the owning side. It's just an annoyance to write the extra @JoinTable in addition to the @ManyToMany annotation.

    I hope I was clear :)

     

Anonymous
Anonymous

Add attachments
Cancel