Hi all, it probably that this has been answered in the list, but I can't
figure out how to construct the query for gmail (I've been on the list for
some time now).
I have the following feature I don't know how to resolve. I am using wicket
1.4rc2 with activeobjects (orm).
I have User and Role entities, and User has a manytomany relationship.
I would like to have a form with a checkgroup to be able to select which
roles a user have.
User has:
String name
String password
@ManyToMany(UserRole.class)
Role[] roles
Role has:
String name
and UserRole has:
User user
Role role
all with corresponding setters and getters.
How could I combine this entities to develop a form in which user could see:
TextField
PasswordTextField
CheckGroup (with the names of the roles available)
?
Thanks
f(t)
PS: some extra info.
this is my model and form (comments other than the question would be grate
also):
//create user entity model
userModel = new LoadableDetachableModel() {
private static final long serialVersionUID = 0L;
@Override
protected SqsUser load() {
Session session;
session = (Session) getSession();
SqsUser user;
if (selectedUser != null)
return selectedUser;
user = null;
try {
user = session.getEntityManager().create(SqsUser.class);
} catch (SQLException ex) {
Logger.getLogger(UsersPanel.class.getName()).log(Level.SEVERE, null, ex);
}
if (user != null)
selectedUser = user;
return user;
}
};
//create user form overriding process to begin transaction
usersForm = new Form("users-form", new
CompoundPropertyModel(userModel)) {
private static final long serialVersionUID = 0L;
private Transaction transaction;
@Override
public void process(IFormSubmittingComponent submittingComponent) {
super.process(submittingComponent);
transaction = new Transaction(((Session)
getSession()).getEntityManager()) {
@Override
protected SqsUser run() throws SQLException {
SqsUser user = getModelObject();
user.save();
return user;
}
};
}
@Override
protected void onSubmit() {
try {
transaction.execute();
} catch (SQLException ex) {
Logger.getLogger(UsersPanel.class.getName()).log(Level.SEVERE, null, ex);
onError();
}
}
@Override
protected void onError() {
}
};