Not sure how to post this question, but I have come across a situation that an idea I have for a solution kind of sounds like a hack to me.
Here is my issue, I have a Form and a DataTable underneath it. I input values into the form, and I click "Add To List" and it adds it to the list. This all works fine. The problem lies in the Form backing object, which is an Entity Bean, but one that gets wrapped in another class, and inside the Entity Bean it also has an Embedded Object. So here is the situation, each item in the list will have the last values entered into the form in all the TripLeg objects in the list.
So I have a Collection of TripLeg objects that has a departure Location object and a destination Location object, The form's backing object is the Location object. Inside the Location object is an Address object. When I fill in the form, the Location object is injected into my conversational Stateful Session Bean. I take that Location object, I get the last TripLeg object, put the location into the destination attribute, and then create a new TripLeg object and put the location into the departure attribute, and as I add more locations this repeats.
I then save my RoadTrip object with all the TripLegs. As it is above, there is only one Location record created in the database, the last one entered on the form, and all legs departures and destinations point to that one record. So I created a makeLocation() private method to create a new instance of Location and put the attributes of the forms Location object into the new object and add that to the Legs. This now makes more than one record into the database (so far so good) but all the records now have the same address, which was the last address entered in the form. I don't want to have to make a deep copy of my Location object to get them to point to their own Location object in memory. (This is where it smells like a hack to me)
Maybe it has something to do with @In and the State Management of Seam, kind of like how a Session in Hibernate will make sure you only have one instance and if you load the same data that is already in the Session it will point your reference to the instance that is in the Session.
Thanks for reading all that.