This content has been marked as final.
Show 1 reply
-
1. Re: entities with dependencies
asookazian Aug 28, 2009 12:22 AM (in response to lucas84)Yes, an entity can be a Seam component (jut add @Name to the class). There's an example early on in SiA book (using entity class as backing bean in JSF page).
No, you can't inject anything into an entity class, even if it's a Seam component. I actually tried this recently and got a NPE.
e.g.
@Name("foo") @Entity @Table(name = "Foo") public class Foo{ @In(create=true) private FacesMessages fm; private String bar; Foo(String bar){ this.bar = bar; fm.add("test"); // <-- NPE here! } public void setBar(String bar){ this.bar = bar; } public String getBar(){ return bar; } }
IIRC the bijection interceptors do not work on entity classes. I'm not sure where in the Seam core codebase it checks for the type of component prior to doing interceptions...