Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bc2ff294
authored
Oct 31, 2010
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cascades
1 parent
6d882242
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Poll.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/PollQuestion.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/PossibleAnswer.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Poll.java
View file @
bc2ff29
...
@@ -6,6 +6,7 @@ import java.io.Serializable;
...
@@ -6,6 +6,7 @@ import java.io.Serializable;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.List
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.FetchType
;
...
@@ -42,7 +43,7 @@ public class Poll extends GenericEventChild implements Serializable {
...
@@ -42,7 +43,7 @@ public class Poll extends GenericEventChild implements Serializable {
@Column
(
name
=
"description"
,
nullable
=
true
)
@Column
(
name
=
"description"
,
nullable
=
true
)
private
String
description
;
private
String
description
;
@OneToMany
(
mappedBy
=
"poll"
,
fetch
=
FetchType
.
EAGER
)
@OneToMany
(
mappedBy
=
"poll"
,
fetch
=
FetchType
.
EAGER
,
cascade
=
CascadeType
.
ALL
)
private
List
<
PollQuestion
>
questions
;
private
List
<
PollQuestion
>
questions
;
public
Poll
()
{
public
Poll
()
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/PollQuestion.java
View file @
bc2ff29
...
@@ -2,6 +2,7 @@ package fi.insomnia.bortal.model;
...
@@ -2,6 +2,7 @@ package fi.insomnia.bortal.model;
import
java.util.List
;
import
java.util.List
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
...
@@ -26,7 +27,7 @@ public class PollQuestion extends GenericEventChild {
...
@@ -26,7 +27,7 @@ public class PollQuestion extends GenericEventChild {
@ManyToOne
@ManyToOne
private
Poll
poll
;
private
Poll
poll
;
@OneToMany
(
mappedBy
=
"question"
)
@OneToMany
(
mappedBy
=
"question"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
PossibleAnswer
>
answers
;
private
List
<
PossibleAnswer
>
answers
;
@Lob
@Lob
...
@@ -41,10 +42,11 @@ public class PollQuestion extends GenericEventChild {
...
@@ -41,10 +42,11 @@ public class PollQuestion extends GenericEventChild {
public
String
getQuestion
()
{
public
String
getQuestion
()
{
return
question
;
return
question
;
}
}
public
boolean
isFreeText
()
{
public
boolean
isFreeText
()
{
return
(
answers
.
size
()
==
1
&&
answers
.
get
(
0
).
isText
());
return
(
answers
.
size
()
==
1
&&
answers
.
get
(
0
).
isText
());
}
}
public
void
setQuestion
(
String
question
)
{
public
void
setQuestion
(
String
question
)
{
this
.
question
=
question
;
this
.
question
=
question
;
}
}
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/PossibleAnswer.java
View file @
bc2ff29
...
@@ -2,6 +2,7 @@ package fi.insomnia.bortal.model;
...
@@ -2,6 +2,7 @@ package fi.insomnia.bortal.model;
import
java.util.List
;
import
java.util.List
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
...
@@ -34,7 +35,7 @@ public class PossibleAnswer extends GenericEventChild {
...
@@ -34,7 +35,7 @@ public class PossibleAnswer extends GenericEventChild {
@ManyToOne
@ManyToOne
private
PollQuestion
question
;
private
PollQuestion
question
;
@OneToMany
(
mappedBy
=
"choice"
)
@OneToMany
(
mappedBy
=
"choice"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
PollAnswer
>
answers
;
private
List
<
PollAnswer
>
answers
;
public
String
getAnswer
()
{
public
String
getAnswer
()
{
...
@@ -85,5 +86,4 @@ public class PossibleAnswer extends GenericEventChild {
...
@@ -85,5 +86,4 @@ public class PossibleAnswer extends GenericEventChild {
this
.
answers
=
answers
;
this
.
answers
=
answers
;
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment