[JBoss Seam] - Re: Problem: Custom validate methods in EJBs crash
by CptnKirk
I agree with Gavin. I've always been ok with complex validation in the action method (or control flow). If you need something a little more declarative, it shouldn't be too hard to use Seam plus EJB interceptors to write your thin framework.
If you think about it this is what JSF is doing anyway with its phased approach to conversion and validation. Being able to use EJB 3 allows you to slip in your own layer immediately preceeding action invocation. You'd then be able to apply any declarative application concerns, including validation, on objects that had already been converted and validated in isolation.
Would it help if Seam provided a "standard" annotation that highlights this ability or should users just implement something like this on their own? I guess if this feature is being requested, giving the masses what they want may have some value, even if it's just providing a utility that they could provide themselves. Utility is a good thing.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970169#3970169
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970169
19 years, 7 months
[EJB 3.0] - Re: JUnit testing EJBs: NoInitialContextException
by ALRubinger
>From within the container, your InitialContext will be configured properly when using the default constructor. From a remote client (another JVM, like your JUnit Test), this isn't the case, and you'll have to get your context:
| Hashtable<String, String> props= new Hashtable<String, String>();
| props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| props.put(Context.PROVIDER_URL,"jnp://localhost:1099" );
| props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces" );
| Context ctx = new InitialContext( props );
|
..replacing the host and port in Context.PROVIDER_URL with something appropriate.
Dependency injection...you'll have to do a lookup for that bean using the Context above - you'll only be able to inject container-managed resources into other container-managed resources.
S,
ALR
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970166#3970166
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970166
19 years, 7 months