Can Hibernate store a collection of different data types

Hi,

I have a use case where I need to create a set of custom fields with different primitive types and their values in say a Person object.
So the Person object would look like -
public class Person {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;

private Set<int, string, boolean...> customFields;

}

Does Hibernate support persisting such a collection. If so, can someone point me on how to achieve the same?

Thanks in advance.

Hibernate does not really support that. This is usually done by using some kind of JSON type on the database side and a custom type or map if you like in the entity model: https://vladmihalcea.com/java-map-json-jpa-hibernate/