package de.lebk.jwebpoll.data;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "answers")
public class Answer
{
    @DatabaseField(generatedId = true)
    private int id;

    @DatabaseField
    private String text;

    @DatabaseField
    private String value;

    @DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = "question_id", canBeNull = true)
    private Question question;

    public Answer()
    {
    }

    public Answer(String text, String value)
    {
        this.text = text;
        this.value = value;
    }

    public int getId()
    {
        return id;
    }

    public String getText()
    {
        return text;
    }

    public String getValue()
    {
        return value;
    }
}
@@ -543,18 +543,37 @@
 ng value
+, Question question
 )%0A
-
     %7B%0A  
@@ -620,24 +620,58 @@
 ue = value;%0A
+        this.question = question;%0A
     %7D%0A%0A    p
@@ -809,32 +809,32 @@
 etValue()%0A    %7B%0A
-
         return v
@@ -844,10 +844,176 @@
 e;%0A    %7D
+%0A%0A    public Question getQuestion()%0A    %7B%0A        return question;%0A    %7D%0A%0A    public void setQuestion(Question question)%0A    %7B%0A        this.question = question;%0A    %7D
 %0A%7D

add setter and getter for answer->question relation