#Could not set value of type [org.hibernate.collection.spi.PersistentMap]

1 messages · Page 1 of 1 (latest)

nimble badger
#

basically all i'm trying to do is
Class/Entity Player, which owns itemDegrationManager which itself has a Map the contents of this map to be "connected/have its own table" to the Entity/Table of Player i.e. players.
i.e.:
Class Player
|-> ItemDegradationManager itemDegradationManager = new ItemDegradationManager(this );
|----> private Map<Integer, Integer> degradationLevels = new HashMap<>();

jagged cosmosBOT
#

<@&987246584574140416> please have a look, thanks.

jagged cosmosBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

nimble badger
#
@Table(name = "players")
public class Player extends Agent {
    @Embedded
    @Column(name = "degradable_items")
    private final ItemDegradationManager itemDegradationManager = new ItemDegradationManager(this);
}```
```@Embeddable
public class ItemDegradationManager {

    private static final boolean ENABLED = true;

    @ElementCollection
    @CollectionTable(name = "degradation_levels", joinColumns = @JoinColumn(name = "player_id"))
    @MapKeyColumn(name = "item_id")
    @Column(name = "degradation_level")
    private final HashMap<Integer, Integer> degradationLevels = new HashMap<>();

    @Transient
    private final Player player;
jagged cosmosBOT