From do-not-reply at jboss.com Mon Oct 1 12:37:02 2007 Content-Type: multipart/mixed; boundary="===============6227567382063726949==" MIME-Version: 1.0 From: djfjboss To: jboss-user at lists.jboss.org Subject: [jboss-user] [JBoss Seam] - Semantics of @Name, @DataModelSelection Date: Mon, 01 Oct 2007 12:37:02 -0400 Message-ID: <32401118.1191256622925.JavaMail.jboss@colo-br-02.atl.jboss.com> --===============6227567382063726949== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In an attempt to learn Seam I am experimenting with a simple CRUD example, = partly based on the Yuan/Heute book. The integration example shows an edit link as: Edit With the Person class having: @Entity | @Name("person") | public class Person { | private long id; | @Id @GeneratedValue | public long getId() { return id;} | public void setId(long id) { this.id =3D id; } and person.xhtml having:

Edit #{person.name}

| | and the ManagerAction class having: @Stateful | @Name("manager") | public class ManagerAction implements Manager { | = | @In (required=3Dfalse) @Out (required=3Dfalse) | private Person person; | = | // @RequestParameter | Long pid; | = | @DataModel | private List fans; | = | @DataModelSelection | private Person selectedFan; | = | public void setPid (Long pid) { | this.pid =3D pid; | = | if (pid !=3D null) { | person =3D (Person) em.find(Person.class, pid); | } else { | person =3D new Person (); | } | } | = | public Long getPid () { | return pid; | } Apologies for taking so long to get to the point but the issue I have is th= at I keep getting property X not found on type Y. I had assumed that a Per= son instance would be maintained in the session state and injected/outjecte= d as appropriate. I had also assumed that the setPid method would be invoked via the edit lin= k and thereby set person to the appropriate entity via the id, but this met= hod isn't even called for me. The fact that the RequestParameter annotatio= n is commented out is a little disconcerting. To make this work, up to a point, I have had to add @Scope(SESSION) to the = entity and session beans but I still find that I am faced with a newly cons= tructed Person instance rather than the one I thought I was operating on an= d that had been outjected into the shared context. In desperation, I've also tried using the @DataModelSelection but without s= uccess - property not found again. I suspect I'm missing something fundamental and have read about bijection a= nd studied the example which look straightforward enough but something is m= issing and I can't figure out what it is! View the original post : http://www.jboss.com/index.html?module=3Dbb&op=3Dv= iewtopic&p=3D4090337#4090337 Reply to the post : http://www.jboss.com/index.html?module=3Dbb&op=3Dpostin= g&mode=3Dreply&p=3D4090337 --===============6227567382063726949==--