[jboss-user] [JBoss Seam] - hibernate validator: how to access seam component
amashtakov
do-not-reply at jboss.com
Mon Sep 3 09:14:14 EDT 2007
Hi everybody,
There are two ejb-s:
- Account (entity)
Account {
...
@AccountLogin
public String getLogin() {...}
...
}
- AccountManager (session)
@Name("accountManager")
AccountManager {
...
public Account findByLogin(String login) {...}
...
}
In order to check if account with the same login already exists or not, I
developed a hibernate validator:
@ValidatorClass(AccountLoginValidator.class)
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface AccountLogin {
String message() default "the same login already exists";
}
I'm trying to inject "accountManager" component into AccountLoginValidator in order to perform check but with no
success - instance variable is always null:
@Name("accountLoginValidator")
public class AccountLoginValidator
implements Validator, PropertyConstraint {
@In(create=true, value="accountManager")
private AccountManagerLocal accountManager;
...
}
With jndi lookup everything works fine, but I'd like to use seam
injection facilities to get this reference.
In any way to do this ?
PS:
In page code bean I always get the reference to "accountManager"
without any problem using the same @In anotation.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080500#4080500
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080500
More information about the jboss-user
mailing list