2 Replies Latest reply on Jul 12, 2010 9:37 PM by Herberson Silva

    Is possible to mapping my Etities by annotaions?

    luiz syncode Newbie

      Good day All!


      If in Seam we have the annotations

      @Name("somename")

      or
      @Entity(name="Something")

      , maybe there is some way to mapping my Etities.


      Is possible to mapping my Etities by annotaions?


      I don't wanna use the persistence.xml to do it.

        • 1. Re: Is possible to mapping my Etities by annotaions?
          luiz syncode Newbie

          Sorry!


          I forgot to show my sample:



          @Entity
          public class Group implements Serializable 
          {
               @ManyToMany(
                   targetEntity=Permission.class,
                   cascade={CascadeType.PERSIST, CascadeType.MERGE}
               )
          
               @JoinTable(
                   name="Group_Permission",
                   joinColumns={@JoinColumn(name="groupid")},
                   inverseJoinColumns={@JoinColumn(name="permissionid")}
               )
          
               public Collection getPermissions() {
                   return teste;
               }
               ...
           }
            
           @Entity
           public class Permission implements Serializable {
               @ManyToMany(
                   cascade={CascadeType.PERSIST, CascadeType.MERGE},
                   mappedBy="teste"
                   targetEntity=Group.class
               )
               public Collection getGroups() {
                   return groups;
               }
           }

          • 2. Re: Is possible to mapping my Etities by annotaions?
            Herberson Silva Newbie

            The answer: YES! Is possible and recommended.