Storing Objects in columns using Hibernate JPA

Posted by user210791 on Stack Overflow See other posts from Stack Overflow or by user210791
Published on 2010-01-23T02:43:49Z Indexed on 2010/05/01 0:37 UTC
Read the original article Hit count: 572

Filed under:
|
|
|
|

Is it possible to store something like the following using only one table? Right now, what hibernate will do is create two tables, one for Families and one for people. I would like for the familymembers object to be serialized into the column in the database.

@Entity(name = "family")
class Family{

    private final List<Person> familyMembers;

}

class Person{

   String firstName, lastName;
   int age;

}

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate