Enums as composite primary key
See original GitHub issueDBFlow Version: 4.0.4, 4.0.5 Issue Kind : Question
Description:
I get a <identifier> expected
error if I have use enum as primary key. Looks like there is a problem with Enums as primary keys or should we handle them differently?
public class Contact {
@NotNull
@PrimaryKey
Long userId;
@NotNull
@PrimaryKey
ContactType type; // Enum
@Column
String name;
...
}
public class User {
@PrimaryKey
Long id;
@ForeignKey(saveForeignKeyModel = true,
deleteForeignKeyModel = true,
tableClass = TaskAddress.class,
onDelete = ForeignKeyAction.SET_NULL,
onUpdate = ForeignKeyAction.CASCADE)
Contact contact;
...
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Composite primary key for a String and an enum type variable
Create one more class, which you can then use as your primary key. To do this you must use @EmbeddedId. Your class:
Read more >Enum used for a primary key pair - CodeRanch
I encounter a problem when i used Enum type for primary key pair. Does anyone have experienc ... usually it is ok to...
Read more >ENUM and ID as a Foreign Key - DBA Stack Exchange
I'm working on a database design and have arrived at a schema that uses a generic "join table". This join table contains five...
Read more >[JPA-7] JPA Support of Enum as Primary Key - Hibernate JIRA
Enums work as primary keys in TopLink and EclipseLink. DataNucleus supports them, too: http://www.datanucleus.org/products/accessplatform/jpa/primary_key.
Read more >Composite key field is not a simple type or enum — oracle-tech
According to the docs here - http://www.oracle.com/technology/documentation/berkeley-db/je/java/index.html?com/sleepycat/persist/model/ ...
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 FreeTop 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
Top GitHub Comments
it seems that I either fixed it or decided to support enums as primary keys. can you check with latest
32dd5e19c
to see if issue is still happening?I will ensure that the error message appears.