This content has been marked as final.
Show 3 replies
-
1. Re: s:hasRole
cash1981 Oct 30, 2009 11:36 PM (in response to nicevision2020)Please post your User entity and Role entity, also look in the database to actually see that the UserRole table is correctly setup and that it correctly contain the data.
-
2. Re: s:hasRole
nicevision2020 Nov 2, 2009 4:09 PM (in response to nicevision2020)@Name("user")
@Entity
@Table(name = "USERS")
@Scope(ScopeType.SESSION)
public class User implements java.io.Serializable {
private static final long serialVersionUID = 3286368646102955349L;
@Id
private Integer id;
@UserPrincipal
@Column(name = "USER_IDENT", nullable = false, length = 300)
private String user_ident;
@UserPassword(hash = "sha-256")
@Column(name = "PASSWORD_HASH", nullable = false, length = 300)
private String passwordHash;
@UserFirstName
@Column(name = "FIRSTNAME", length = 50)
private String firstName;
@UserLastName
@Column(name = "LASTNAME", length = 50)
private String lastName;
@UserRoles
@ManyToMany(targetEntity = Role.class)
@JoinTable(name = "USERS_ROLES", joinColumns = @JoinColumn(name = "USERS_KEY"), inverseJoinColumns = @JoinColumn(name = "ROLES_KEY"))
private Set<Role> roles = new HashSet<Role>(0);
// Constructors
/** default constructor */
public User() {
}
}
@Name("role")
@Entity
@Table(name = "ROLES", uniqueConstraints = @UniqueConstraint(columnNames = "ROLES_NAME"))
public class Role implements java.io.Serializable {
private static final long serialVersionUID = -3521059209735275880L;
@Id
private Integer id;
@RoleName
@Column(name = "ROLES_NAME", unique = true, length = 300)
private String roles_name;
@Column(name = "ROLES_DESCRIPTION")
private String description;
// Constructors
/** default constructor */
public Role() {
}
} -
3. Re: s:hasRole
nicevision2020 Nov 3, 2009 8:06 PM (in response to nicevision2020)Sorry i fixed the issue. Thats my bad. Deployment problem. Thanks for helping.