More specificly, how do I save a list of type class with Hibernate?
I have the following (simplefied) class:
@Entity
@Table(name = "bundles")
public class Bundle{
@Id
private Long id;
private List<Class<?>> classes;
// Getters & Setters and some logic
}
Now, how do I go about saving this in a database? I need a database schema wich provides an option to save a “class” type, but I can’t figure it out. I use PostgreSQL as a database.
The fact that it is a List would not really matter, I would just annotate it with @OneToMany.
According to the documentation,
Class<?>is correctly handled by hibernate:The database “column” needs to be
VARCHAR