How can I map a Map in JPA without using Hibernate's classes?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Does not the following work for you?
EntityType
could be any entity type, including aString
.Although answer given by Subhendu Mahanta is correct. But
@CollectionOfElements
is deprecated. You can use@ElementCollection
instead:There is no need to create a separate Entity class for the
Map
field. It will be done automatically.A working example:
Suppose I have an entity named Book which is having a Map of chapters:
It works for me.