I have changed Address from @embedable to @entity (also made a DB table for
it of course) and made a oneToOne mapping from User to Adres (optional), so
a User can have an Address, but its not obligatory. 

Now I get this interesting behaviour:

If I remove the address block from userForm, then the User gets saved okay.
The fk to address stays empty as expected.

When I add the address block back to userForm, then I get an exception
stating:

object references an unsaved transient instance - save the transient
instance before flushing: com.hw.app.model.Address; nested exception is
org.hibernate.TransientObjectException: object references an unsaved
transient instance - save the transient instance before flushing:
com.hw.app.model.Address 

I do understand, that the address would have to be saved first, before
saving the User, but I do not understand the following:

1) It seems input field validations for address are not fired up before the
exception arises. Why?
2) How come that adding the address block to the form causes the
instantiation of the address object reference? Is this caused by spring's
dependency injection? If so, where is this relation configured?
3) Where (in the code) are the request parameter values for the address
(such as country and so on) passed on to the instantiated Address object?

Thank You,
MPK

-- 
View this message in context: 
http://www.nabble.com/Dependancy-injection--tp25428272s2369p25428272.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to