I'm setting up an application that has an object called Person.  Every Person 
has an Address.  But it's more complicated than that.  For various legal and 
accounting reasons, we need to keep track of every Address that Person has ever 
had.  So I set it up like this:


  | @Entity public class Person {
  | 
  |    private List<Address> addresses;
  | 
  |    public List<Address> getAddresses() { ... }
  |    public void setAddresses(List<Address> list) { .... }
  | 
  |    // and to make it easy to get the current address:
  |    public void setCurrentAddress(Address address) {
  |        if(addressess == null) addresses = new LinkedList<Addresses>();
  |        addresses.add(address);
  |    }
  | 
  |    public Address getAddress() {
  |        // return the last element in the addresses array
  |    }
  | }
  | 

Pretty straight-forward, right?  Oh, and I have set Cascade to ALL for these 
lists, so that is taken care of.

How do I handle this within Seam?  If I don't put @Transient on getAddress(), 
then it creates a bytea field in the DB to store the address, which is not what 
I want.  If I do market it as transient, nothing gets stored.

There must be some simple way to handle this, right?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965387#3965387

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965387
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to