This content has been marked as final. 
    
Show                 4 replies
    
- 
        1. Re: Navigating depth in object graphpmuir Jul 27, 2006 7:06 AM (in response to angelogalvao)How about in your Client Entity public class Client { private Address address; ... public Client() { address = new Address(); } // Getters and Setters }
- 
        2. Re: Navigating depth in object graphangelogalvao Jul 27, 2006 7:36 AM (in response to angelogalvao)"petemuir" wrote: 
 How about in your Client Entitypublic class Client { private Address address; ... public Client() { address = new Address(); } // Getters and Setters }
 OK... but if my address is not required??? when i try to save the client i got a TransientObjectException, something like that!!! :(
- 
        3. Re: Navigating depth in object graphpmuir Jul 27, 2006 7:52 AM (in response to angelogalvao)If it's not required then set it to null. 
 You could also do it in an action method - client.setAddress(new Address()); if you want more control over whether an address is created or not.
 Sorry, my code wasn't complete - you would need a association annotation with at least cascade=PERSIST
- 
        4. Re: Navigating depth in object graphangelogalvao Jul 27, 2006 8:04 AM (in response to angelogalvao)"petemuir" wrote: 
 If it's not required then set it to null.
 You could also do it in an action method - client.setAddress(new Address()); if you want more control over whether an address is created or not.
 Sorry, my code wasn't complete - you would need a association annotation with at least cascade=PERSIST
 That is my problem :( , because if i put, for example, my address to null i will have a "javax.faces.el.PropertyNotFoundException: Base is null: bla bla..." if i try to submit something like <h:inputText id="addressNumberInput" value="#{cliente.address.number}"/>...
 My solution is put this in action method like you say, but i have a lot of relationships in the client, with address, sex, etc... i think this give a lot of work and make my code ugly....
 That why i say that ognl null handler thats ww use is cool if getAddress return null he instanciates a new one the time i need, so if no address was typed no address is create, that saomething like that in EL???
 
    