I am working with a project where I need to store a object in hibernate and it consist of many user defined objects. I know how use hibernate mapping with a object that only contain "ususal" types(int, String, etc...) but with custom types I've seen suggestions such as usage of the annotation @embedded and implementing UserType but I haven't seen any suggestion on how to simply map the objects inside the object to a certain table. Note: these objects aren't going in the same table, just in the same db. What I want to do is have a mapping that allows this function in my DaoImplementation:
public void store(MyObject o){
hibernateTemplate.saveOrUpdate(o);
}
This is soft of how my object looks:
public class MyObject{
private String name;
private ObjectA type;//Contains an int
private ObjectC look;//Contains a String.
private ObjectB[] children;//contains a string and other children.
public MyObject(){}
//Getters and setters omitted.
}
public class ObjectB{
private String name;
private ObjectB[] children;
public ObjectB(){}
//Getters setters omitted
}