休眠异常:@OneToMany或@ManyToMany面向未映射的类[java.util.List]

时间:2018-09-17 09:38:39

标签: java hibernate dictionary mapping

我有一个MessengerData类,其中包含资源列表。这是我想要的结构示例:

 "messengerData":{  
  "fr":{  
        "messengerType":"ImageCategoryTitle",
        "imageURL":"https://assets.pernod-ricard.com/uk/media_images/test.jpg",
        "clickURL":"http://perdu.com",
        "videoURL":"",
        "brickSize":80,
        "textDatas":{  
           "category":{  
              "color":"#000000",
              "fontSize":14,
              "textValue":"Texte de cat\u00e9gorie en fran\u00e7ais"
           },
           "title":{  
              "color":"#D66060",
              "fontSize":12,
              "textValue":"Titre en fr, peut aussi avoir des markusp genre <b>bold</b> <i>italique</i> <s>strike</s> <u>underline</u>"
           }
        }
     },
  "en": 
     {  
        "messengerType":"ImageCategoryTitle",
        "imageURL":"https://assets.pernod-ricard.com/uk/media_images/test.jpg",
        "clickURL":"http://perdu.com",
        "videoURL":"",
        "brickSize":80,
        "textDatas":{  
           "category":{  
              "color":"#000000",
              "fontSize":14,
              "textValue":"Category text can be sized differently"
           },
           "title":{  
              "color":"#D66060",
              "fontSize":12,
              "textValue":"Title color may change"
           }
        }
     }

}

这是我定义实体的方式:

@Entity
public class MessengerData
{
@Basic
@Id
@GeneratedValue(generator = "notification-system-uuid")
@GenericGenerator(name = "notification-system-uuid", strategy = "uuid")
private String messengerDataId;

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "idResource")
private Map<String, List<Resource>> resources;

我的问题是我收到了这篇帖子标题中描述的异常。我使用地图是因为我想尊重json格式。

有人可以帮我吗?

0 个答案:

没有答案