This is the entity:

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import net.anwaltsdatenbank.adb.client.domain.PersistedEntity;

@Entity
@Table(name = "users")
public class User implements PersistedEntity<Integer> {

        private static final long serialVersionUID = 762298174599256998L;

        @Id
        @GeneratedValue(strategy=GenerationType.IDENTITY)
        @Column(name = "user_id")
        private Integer id;

        @Column(name = "username")
        private String username;

        @Column(name = "user_password")
        private String password;

        @ManyToMany(fetch = FetchType.EAGER)
        @JoinTable(name = "user_groups", joinColumns = @JoinColumn(name =
"user_id"), inverseJoinColumns = @JoinColumn(name = "group_id"))
        private Set<Group> groups;

        public User(String username, String password) {
                super();
                this.username = username;
                this.password = password;
        }

        public User() {
        }

        public Integer getId() {
                return id;
        }

        public void setId(Integer id) {
                this.id = id;
        }

        public String getUsername() {
                return username;
        }

        public void setUsername(String username) {
                this.username = username;
        }

        public Set<Group> getGroups() {
                return groups;
        }

        public void setGroups(Set<Group> groups) {
                this.groups = groups;
        }

        public String getPassword() {
                return password;
        }

        public void setPassword(String password) {
                this.password = password;
        }
}

And the PersistedEntity Interface:

import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;

public interface PersistedEntity<KEYTYPE> extends Serializable,
IsSerializable {

        KEYTYPE getId();
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to