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 2b75e123
authored
May 13, 2012
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OrgRole and Role ManyToMany
1 parent
267cc600
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
code/LanBortalDatabase/src/fi/insomnia/bortal/model/OrgRole.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Role.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/OrgRole.java
View file @
2b75e12
...
@@ -51,7 +51,7 @@ public class OrgRole extends GenericEntity {
...
@@ -51,7 +51,7 @@ public class OrgRole extends GenericEntity {
@ManyToOne
()
@ManyToOne
()
private
EventOrganiser
eventOrganizer
;
private
EventOrganiser
eventOrganizer
;
@
OneToMany
@
ManyToMany
(
mappedBy
=
"orgRoles"
)
private
List
<
Role
>
eventRoles
;
private
List
<
Role
>
eventRoles
;
public
OrgRole
()
{
public
OrgRole
()
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Role.java
View file @
2b75e12
...
@@ -31,7 +31,7 @@ public class Role extends GenericEntity {
...
@@ -31,7 +31,7 @@ public class Role extends GenericEntity {
protected
static
final
String
NAME_COLUMN
=
"role_name"
;
protected
static
final
String
NAME_COLUMN
=
"role_name"
;
protected
static
final
String
EVENT_ID_COLUMN
=
"event_id"
;
protected
static
final
String
EVENT_ID_COLUMN
=
"event_id"
;
protected
static
final
String
ORG_ROLE_ID_COLUMN
=
"org_role_id"
;
protected
static
final
String
ORG_ROLE_ID_COLUMN
=
"org_role_id"
;
public
static
final
Role
EMPTY_ROLE
=
new
Role
(
"----"
);
public
static
final
Role
EMPTY_ROLE
=
new
Role
(
"----"
);
...
@@ -76,10 +76,12 @@ public class Role extends GenericEntity {
...
@@ -76,10 +76,12 @@ public class Role extends GenericEntity {
@ManyToOne
@ManyToOne
@JoinColumn
(
name
=
EVENT_ID_COLUMN
,
nullable
=
false
)
@JoinColumn
(
name
=
EVENT_ID_COLUMN
,
nullable
=
false
)
private
LanEvent
event
;
private
LanEvent
event
;
@ManyToOne
@ManyToMany
@JoinColumn
(
name
=
ORG_ROLE_ID_COLUMN
)
@JoinTable
(
name
=
"roles_provided_by_org_roles"
,
private
OrgRole
orgRole
;
joinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
Role
.
ID_COLUMN
)
},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"org_role_id"
,
referencedColumnName
=
OrgRole
.
ID_COLUMN
)
})
private
List
<
OrgRole
>
orgRoles
;
public
Role
()
{
public
Role
()
{
super
();
super
();
...
@@ -196,12 +198,12 @@ public class Role extends GenericEntity {
...
@@ -196,12 +198,12 @@ public class Role extends GenericEntity {
this
.
users
=
users
;
this
.
users
=
users
;
}
}
public
OrgRole
getOrgRole
()
{
public
List
<
OrgRole
>
getOrgRoles
()
{
return
orgRole
;
return
orgRole
s
;
}
}
public
void
setOrgRole
(
OrgRole
orgRole
)
{
public
void
setOrgRole
s
(
List
<
OrgRole
>
orgRoles
)
{
this
.
orgRole
=
orgRole
;
this
.
orgRole
s
=
orgRoles
;
}
}
}
}
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