I have class like this
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@ElementCollection
@Transient
@JsonProperty("custom_fields")
private Map<String, String> customFields;
private String description;
}
However I dont want 'customFields' field to store in the database. So I have used @Transient annotation with it. But it is creating new table and creating foreign key. And value of 'customFields' is getting stored in that table. I guess it is happening because of @ElementCollection annotation. If I remove @ElementCollection I am getting this exception: Could not determine type for: java.util.Map, at table. However @Transient works perfectly if Field is not a collection.
How can I achieve this ? I want that field in class but don't want to store it in database.