Java Hibernate Mapping Exception! (Could not determine type for: java.util.Map)

前端 未结 5 1141
[愿得一人]
[愿得一人] 2021-01-18 14:00

I have made a class with name of Movie with folowing fields:

    @Id
@GeneratedValue
private Long id;
private String name;
@ElementCollection(targetClass = S         


        
相关标签:
5条回答
  • 2021-01-18 14:32

    Aah I see, its a . I dont think you can map a primitive unless you are using latest jar. https://forum.hibernate.org/viewtopic.php?t=955308. Check that link. Could you make a class called as Properties with key and value and then use it? I had a similar problem and I had to use that approach.

    0 讨论(0)
  • 2021-01-18 14:41

    Shouldn't properties just be a List<String> type?

    It sounds like Hibernates confusion is the same as mine which is, why is Properies a Map instead of a list? What exactly are you trying to do there?

    0 讨论(0)
  • 2021-01-18 14:42

    I also face the same problem.It is late but i think it will help others.use @MapKeyColumn.here is my simple code

    @ElementCollection(targetClass=String.class)
    @MapKeyColumn(name="Employee_Position")
    private Map<String,String> position=new HashMap<String,String>();
    
    0 讨论(0)
  • 2021-01-18 14:42

    Do you have both getter and setter for Properties?

    0 讨论(0)
  • 2021-01-18 14:48

    that's because you have to use some jpa2 implementation! this guy had the same problem

    0 讨论(0)
提交回复
热议问题