2012-05-14 79 views
-1

这是错误:我无法理解下面的错误

A JPA error occurred (Unable to build EntityManagerFactory): Could not determine type for: java.util.List, at table: Question, for columns: [org.hibernate.mapping.Column(Choices)]

我不明白我已经在其他类中使用列表中的错误,但他们有关系的其他类,他们不得不类型的其他类,但在这里,我不明白他为什么不看到列表

package models; 


import play.*; 
import play.db.jpa.*; 

import javax.persistence.*; 
import java.lang.reflect.Array; 
import java.util.*; 


@Entity 
public class Question extends Model{ 
public String theQuestion; 
public int marks; 
public List<String> Choices; 
@ManyToOne 
@JoinTable (name="questionInEexercise") 
public Exercise myExercise; 



public Question(String question,int marks,long Eid){ 
    this.theQuestion = question; 
    this.marks = marks; 
    this.myExercise = Exercise.findById(Eid); 
    Choices = new ArrayList<String>(); 
} 
+1

对于未来的问题,您可能希望使用更具描述性的问题文本,以便让可能知道您在说什么的人获得更多意见。 – digitaljoel

回答

1

JPA不知道如何将字符串列表正确映射的类型。您可以将它映射到ElementCollection,以便JPA知道如何处理它。

+0

非常感谢它的工作 – hadeer