added unit sql to current.sql and added unit attribute to role entity
This commit is contained in:
parent
3982f6798c
commit
18780cf425
@ -0,0 +1,8 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS unit (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`identifier` bigint(20) DEFAULT NULL,
|
||||||
|
`title` varchar(255) NOT NULL,
|
||||||
|
`version` int(4) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `identifier` (`identifier`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2925 ;
|
@ -1,15 +1,6 @@
|
|||||||
package se.su.dsv.scipro.data.dataobjects;
|
package se.su.dsv.scipro.data.dataobjects;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorColumn;
|
import javax.persistence.*;
|
||||||
import javax.persistence.DiscriminatorType;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Inheritance;
|
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.UniqueConstraint;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorColumn(name = "rolename", discriminatorType = DiscriminatorType.STRING, length = 8)
|
@DiscriminatorColumn(name = "rolename", discriminatorType = DiscriminatorType.STRING, length = 8)
|
||||||
@ -26,6 +17,9 @@ public abstract class Role extends LazyDeletableDomainObject implements Comparab
|
|||||||
@ManyToOne(optional=false)
|
@ManyToOne(optional=false)
|
||||||
protected User user;
|
protected User user;
|
||||||
|
|
||||||
|
@OneToOne(optional=true)
|
||||||
|
private Unit unit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id the id to set
|
* @param id the id to set
|
||||||
*/
|
*/
|
||||||
@ -128,4 +122,11 @@ public abstract class Role extends LazyDeletableDomainObject implements Comparab
|
|||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Unit getUnit() {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnit(Unit unit) {
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user