- 
        1. Re: Hibernate Validators as Seam components?eirirlar Feb 19, 2008 1:07 PM (in response to eirirlar)So far I've done this in components.xml <component name="myDao" class="MyDao" auto-create="true" scope="stateless" /> <component name="myValidator" class="MyValidator" auto-create="true" scope="stateless"> <property name="myDao">#{myDao}</property> </component>myValidator is an instance of org.hibernate.Validator.Validator. 
 myDao is a static property of myValidator, and I attempt to inject it via EL in components.xml.This doesn't work. When I reach the isValid-method of myValidator, myDao has value null. Does anyone have a better example of using seam-components from hibernate validator instances? 
- 
        2. Re: Hibernate Validators as Seam components?eirirlar Feb 19, 2008 1:15 PM (in response to eirirlar)By the way, I cannot use seam annotations in myDao and myValidator since they are shared by a non-seam project. 
- 
        3. Re: Hibernate Validators as Seam components?gavin.king Feb 19, 2008 2:38 PM (in response to eirirlar)You could call Component.getInstance() from inside the validator class, I suppose... 
- 
        4. Re: Hibernate Validators as Seam components?eirirlar Feb 20, 2008 8:47 AM (in response to eirirlar)I tried this (in the validators initialize()-method): this.myDao = (MyDao) Component.getInstance(MyDao.class); and got No @Name annotation for class: MyDao As listed previously, I already configured MyDao in components.xml - so it has no @Name annotation. Is this a bug? Is there another way to get hold of seam components from non-seam components? 
- 
        5. Re: Hibernate Validators as Seam components?nickarls Feb 20, 2008 9:58 AM (in response to eirirlar)
 Eirik Larsen wrote on Feb 20, 2008 08:47 AM:
 
 Is there another way to get hold of seam components from non-seam components?
 How does Contexts.lookupInStatefulContextorsomethinglikethat react? 
- 
        6. Re: Hibernate Validators as Seam components?eirirlar Feb 20, 2008 11:17 AM (in response to eirirlar)
 How does Contexts.lookupInStatefulContextorsomethinglikethat react?It works IF I already have myDao in a stateful scope. However, this is not so easy to accomplish in components.xml (I cannot annotate as MyDao is shared between projects). I've created a temporary component that starts up myDao: @Scope(APPLICATION) @Name("daoHelper") @Startup(depends = "myDao") public class ValidatorHelper {}I really hope to get rid of this one and do something similar to the @Startup-annotation in my components.xml instead. Ideas? 
- 
        7. Re: Hibernate Validators as Seam components?pmuir Feb 20, 2008 11:17 AM (in response to eirirlar)Use Component.getInstance("myDao"); 
- 
        8. Re: Hibernate Validators as Seam components?eirirlar Feb 20, 2008 11:30 AM (in response to eirirlar)
 Use Component.getInstance("myDao")Thanks Pete, that worked without daoHelper to initialize myDao. 
- 
        9. Re: Hibernate Validators as Seam components?schevus.swosborne.magellanhealth.com Jun 30, 2008 4:59 PM (in response to eirirlar)Is there an easier way to do this if annotations are an option? Also, what are the repercussions of using Component.getInstance()? That is the method I am currently trying, but it is somehow causing an infinite loop leading to a StackOverflowException when I call flush(). Any help is appreciated. 
 
     
     
     
    