question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An enum property isn't mapped to the PostgreSQL enum inside value objects

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
YohDeadfallcommented, Dec 6, 2018

We have moved out from EF for the current project (: Will check it when I have half an hour to spare.

0reactions
YohDeadfallcommented, Dec 12, 2018

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found