Is there anything objectionable to this, or is it fine?
There's no definitive answer to this. The best answer is: it depends to the design of your application.
When to use it
If your Client
object should navigate to the Site
object and your Site
object should navigate to the Client
object, then the current example in your code is fine. Still, probably you will need some way to associate these elements, probably by an additional id field on one of the classes or in both.
If it happens that you work with a framework that helps you to bind the classes automatically like Hibernate, then maintaining the circular reference won't be a problem for you.
When not to use it
Basically, for text serialization, since it will generate an infinite loop. As already mentioned in Raibaz's answer, a library like Jackson will fall into infinite loop while serializing Client
or Site
class into a JSON string1. Note that this is also valid when serializing to other String
data like passing the objects through a JAX-WS web service in XML (more info: What happens to generic class in jax-ws webservice?).
1 This can be solved using annotations (@Something
) that belong to a specific library e.g. @JsonManagedReference
and @JsonBackReference
from Jackson library, as noted by @SimonAndréForsberg, but the downside of this solution is that your classes will have tight coupling with the library.