added keywords set to keywords entity

This commit is contained in:
fred-fri 2012-05-10 11:29:44 +09:00
parent 600e9e8a72
commit 99977f1f38
2 changed files with 19 additions and 6 deletions
resources/db_update_scripts
src/main/java/se/su/dsv/scipro/match/dataobject

@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS `Keyword_Keyword` (
`Keyword_id` bigint(20) NOT NULL,
`associatedKeywords_id` bigint(20) NOT NULL,
PRIMARY KEY (`Keyword_id`,`associatedKeywords_id`),
KEY `FKC121395398ED461` (`Keyword_id`),
KEY `FKC121395356E25A3A` (`associatedKeywords_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `Keyword_Keyword`
ADD CONSTRAINT `FKC121395356E25A3A` FOREIGN KEY (`associatedKeywords_id`) REFERENCES `Keyword` (`id`),
ADD CONSTRAINT `FKC121395398ED461` FOREIGN KEY (`Keyword_id`) REFERENCES `Keyword` (`id`);

@ -1,16 +1,14 @@
package se.su.dsv.scipro.match.dataobject;
import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import se.su.dsv.scipro.data.dataobjects.LazyDeletableDomainObject;
import java.util.Set;
@Entity
@Cacheable(true)
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@ -28,7 +26,10 @@ public class Keyword extends LazyDeletableDomainObject {
@ManyToOne
private KeywordType type;
@ManyToMany
private Set<Keyword> associatedKeywords;
public Keyword() {
}