An enum property isn't mapped to the PostgreSQL enum inside value objects
See original GitHub issueThe problem occurs only for value objects inside complex objects. The following example maps PhoneNumberType
to int
:
public enum PhoneNumberType
{
Mobile,
Home,
Work
}
public class PhoneNumber
{
public PhoneNumberType Type { get; set; }
public int Number { get; set; }
}
public class Contact
{
public PhoneNumber Phone { get; set; }
}
builder.OwnsOne(e => e.Phone).Property(p => p.Type);
builder.OwnsOne(e => e.Phone).Property(p => p.Number);
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Hibernate mapping between PostgreSQL enum and Java ...
It does not resolve mapping to psql enum type, but it can simulate @Enumerated(EnumType.STRING) or @Enumerated(EnumType.ORDINAL) in a good way.
Read more >Documentation: 15: 8.7. Enumerated Types
Enumerated (enum) types are data types that comprise a static, ordered set of values. They are equivalent to the enum types supported in...
Read more >Enum Type Mapping
First, you must specify the PostgreSQL enum type on your model, just like you would with tables, sequences or other databases objects: protected...
Read more >JPA — How To Map Java enum To PostgreSQL enum Type
Description: This application maps a Java enum type to PostgreSQL enum type. Key points: define a custom Hibernate EnumType; register this custom EnumType...
Read more >Why would you store an enum in DB?
With an 'enum-in-the-table' approach, you update the enum list to have a new priority. ... The set of valid values is data, not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We have moved out from EF for the current project (: Will check it when I have half an hour to spare.
Looks like I’ve omitted some part that triggers the problem or most likely had an issue in the application… Closing as I can’t reproduce it too. Thanks for taking a look!