Reputation: 1
I have something like this for defining the hibernate type mapping in the entity class:
@Entity
@Table(name = "TEST_TABLE")
public class Test {
@Type( type = "jsonb" )
@Column(name = "CONTENT_FILES")
private List<ContentFile> contentFiles;
}
which map an entity field to a custom defined hibernate type jsonb for supporting PostgreSQL DB.
I would like to change the mapping to another hibernate custom type json for supporting MSSQL DB.
Can I support both mappings in the same entity class?
I tried to use the @Profile annotation but it doesn't work.
@Profile("pgsql")
@Type( type = "jsonb" )
@Profile("mssql")
@Type( type = "json" )
@Column(name = "CONTENT_FILES")
private List<ContentFile> contentFiles;
Upvotes: 0
Views: 508
Reputation: 662
json and jsonb both data types are almost identical according to the PostgreSQL documentation.Therefor you don't have to maintain two different data types to keep json in MSSQL and in PostgreSQL . Please refer to below link of PostgreSQL documentation.
Upvotes: 1