There are a few approaches, depending on what you want to accomplish. You could write a function that writes a separate CSV for the owners and dogs, where they could reference each other using a key, like a sql primary key. Or you could simply inline the information into one, maybe with columns like:
dog_name, owner_name, owner_age, owner_address
What Java Beans can allow you to do is what is called serialization, where you let Java handle how to read and write objects from disk. Normally, you'd run into issues where Java does not know how to serialize objects that are nested inside each other, but by using Beans you can still accomplish this. You could do this by making Dog implement java.io.Serializable
. Check out this guide from TutorialsPoint.
More info about beans here.