Added resource and annotation services.
diff --git a/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java b/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java
index 622ed76..ba12856 100644
--- a/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java
+++ b/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java
@@ -1,26 +1,91 @@
 package de.ids_mannheim.korap.dao;
 
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+import org.antlr.v4.parse.ANTLRParser.id_return;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Component;
+
+import de.ids_mannheim.korap.entity.Annotation;
+import de.ids_mannheim.korap.entity.AnnotationPair;
 
 
 /**
- * AnnotationDao manages SQL queries regarding information about
- * annotations, e.g foundries and layers.
+ * AnnotationDao manages SQL queries regarding annotations including
+ * foundry and layer pairs.
  * 
  * @author margaretha
  *
  */
+@Component
 public class AnnotationDao {
 
     private static Logger jlog = LoggerFactory.getLogger(AnnotationDao.class);
     private NamedParameterJdbcTemplate jdbcTemplate;
 
+    @PersistenceContext
+    private EntityManager entityManager;
 
-    public AnnotationDao () {
-        // TODO Auto-generated constructor stub
+
+    /**
+     * Select all foundry and layer pairs.
+     * 
+     * @return a list of all foundry and layer pairs.
+     */
+    public List<AnnotationPair> getAllFoundryLayerPairs () {
+        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<AnnotationPair> query = criteriaBuilder
+                .createQuery(AnnotationPair.class);
+        Root<AnnotationPair> annotationPair = query.from(AnnotationPair.class);
+        annotationPair.fetch("annotation1");
+        annotationPair.fetch("annotation2");
+        query.select(annotationPair);
+        Query q = entityManager.createQuery(query);
+        return q.getResultList();
     }
     
-    
+    public List<AnnotationPair> getAllAnnotationDescriptions () {
+        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+        CriteriaQuery<AnnotationPair> query = criteriaBuilder
+                .createQuery(AnnotationPair.class);
+        Root<AnnotationPair> annotationPair = query.from(AnnotationPair.class);
+        annotationPair.fetch("annotation1");
+        annotationPair.fetch("annotation2");
+        annotationPair.fetch("values");
+        query.select(annotationPair);
+        Query q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
+
+
+    /**
+     * Select foundry and layer pairs' information of the given foundries.
+     * 
+     * @return a list of foundry and layer pairs.
+     */
+    public List<AnnotationPair> getFoundryLayerPairs (List<String> foundries) {
+        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+
+        CriteriaQuery<Object> query = criteriaBuilder.createQuery();
+        Root<Annotation> annotation = query.from(Annotation.class);
+        Root<AnnotationPair> annotationPair = query.from(AnnotationPair.class);
+        Predicate foundryPredicate = criteriaBuilder.equal(annotation.get("symbol"),
+                foundries);
+        Predicate valuePredicate =  criteriaBuilder.equal(annotationPair.get("value").get("id"),
+                annotation.get("id"));
+        Predicate wherePredicate = criteriaBuilder.and(foundryPredicate,valuePredicate);
+        query.multiselect(annotation, annotationPair).where(wherePredicate);
+        Query q = entityManager.createQuery(query);
+        return q.getResultList();
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java b/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java
index 564ec4e..46c6432 100644
--- a/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java
+++ b/src/main/java/de/ids_mannheim/korap/dao/ResourceDao.java
@@ -28,12 +28,18 @@
 
     @PersistenceContext
     private EntityManager entityManager;
-
+    
+    /** Select all from the resource table  
+     *  
+     * @return a list of resources
+     */
     public List<Resource> getAllResources () {
         CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
         CriteriaQuery<Resource> query = criteriaBuilder.createQuery(Resource.class);
-        Root<Resource> r = query.from(Resource.class);
-        Query q = entityManager.createQuery(query.select(r));
+        Root<Resource> resource = query.from(Resource.class);
+        resource.fetch("layers");
+        query.select(resource);
+        Query q = entityManager.createQuery(query);
         return q.getResultList();
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/entity/Annotation.java b/src/main/java/de/ids_mannheim/korap/entity/Annotation.java
index 8943e9c..0dd4546 100644
--- a/src/main/java/de/ids_mannheim/korap/entity/Annotation.java
+++ b/src/main/java/de/ids_mannheim/korap/entity/Annotation.java
@@ -9,15 +9,22 @@
 import lombok.Getter;
 import lombok.Setter;
 
-@Getter
 @Setter
+@Getter
 @Entity
 @Table(name = "annotation")
 public class Annotation {
+
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     private int id;
     private String symbol;
     private String type;
     private String description;
+
+    @Override
+    public String toString () {
+        return "id=" + id + ", symbol= " + symbol + ", type= " + type
+                + ", description=" + description;
+    }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/entity/AnnotationPair.java b/src/main/java/de/ids_mannheim/korap/entity/AnnotationPair.java
index 1b9ca7a..3e15d78 100644
--- a/src/main/java/de/ids_mannheim/korap/entity/AnnotationPair.java
+++ b/src/main/java/de/ids_mannheim/korap/entity/AnnotationPair.java
@@ -1,17 +1,25 @@
 package de.ids_mannheim.korap.entity;
 
+import java.util.Set;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
 
 import lombok.Getter;
 import lombok.Setter;
 
-@Getter
 @Setter
+@Getter
 @Entity
 @Table(name = "annotation_pair")
 public class AnnotationPair {
@@ -24,6 +32,33 @@
     private int annotationId2;
     @Column(name = "de_description")
     private String germanDescription;
-    // english description
-    private String description;
+    @Column(name = "description")
+    private String englishDescription;
+
+    @OneToOne(fetch=FetchType.LAZY)
+    @JoinColumn(name = "annotation1", insertable = false, updatable = false)
+    private Annotation annotation1;
+
+    @OneToOne(fetch=FetchType.LAZY)
+    @JoinColumn(name = "annotation2", insertable = false, updatable = false)
+    private Annotation annotation2;
+
+    @ManyToMany(fetch=FetchType.LAZY)
+    @JoinTable(
+            name="annotation_pair_value",
+            joinColumns=@JoinColumn(name="pair_id", referencedColumnName="id"),
+            inverseJoinColumns=@JoinColumn(name="value_id", referencedColumnName="id")
+    )
+    private Set<Annotation> values;
+
+    @Override
+    public String toString () {
+        return "id=" + id + ", annotation1=" + annotationId1 + ", annotation2="
+                + annotationId1 + ", description=" + englishDescription
+                + ", germanDescription= " + germanDescription 
+                + "annotation1= "+ annotation1
+                + "annotation2= "+ annotation2;
+                
+    }
+
 }
diff --git a/src/main/java/de/ids_mannheim/korap/entity/Resource.java b/src/main/java/de/ids_mannheim/korap/entity/Resource.java
index b71cf88..18cec9e 100644
--- a/src/main/java/de/ids_mannheim/korap/entity/Resource.java
+++ b/src/main/java/de/ids_mannheim/korap/entity/Resource.java
@@ -1,10 +1,14 @@
 package de.ids_mannheim.korap.entity;
 
+import java.util.Set;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
+import javax.persistence.FetchType;
 import javax.persistence.Id;
+import javax.persistence.JoinTable;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToMany;
 import javax.persistence.Table;
 
 import lombok.Getter;
@@ -19,18 +23,27 @@
     @Id
     private String id;
 
-    // german title
-    private String title;
+    @Column(name = "de_title")
+    private String germanTitle;
 
     @Column(name = "en_title")
     private String englishTitle;
-    private String description;
+    
+    @Column(name = "en_description")
+    private String englishDescription;
 
-
+    @ManyToMany(fetch=FetchType.LAZY)
+    @JoinTable(
+            name="resource_layer",
+            joinColumns=@JoinColumn(name="resource_id", referencedColumnName="id"),
+            inverseJoinColumns=@JoinColumn(name="layer_id", referencedColumnName="id")
+    )
+    private Set<AnnotationPair> layers;
+    
     @Override
     public String toString () {
-        return "id=" + id + ", title=" + title + ", english title="
-                + englishTitle + ", description="+description;
+        return "id=" + id + ", germanTitle=" + germanTitle + ", englishTitle="
+                + englishTitle + ", description="+englishDescription+ ", layers= "+layers;
     }
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java b/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
index 84537a5..835106b 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
@@ -29,7 +29,7 @@
             return mapper.writeValueAsString(values);
         }
         catch (JsonProcessingException e) {
-            return "";
+            return e.getMessage();
         }
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java
index e519a10..06b4299 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/AnnotationService.java
@@ -12,10 +12,16 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
 
 import com.sun.jersey.spi.container.ResourceFilters;
 
+import de.ids_mannheim.korap.dao.AnnotationDao;
+import de.ids_mannheim.korap.entity.Annotation;
+import de.ids_mannheim.korap.entity.AnnotationPair;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.KustvaktServer;
 import de.ids_mannheim.korap.web.filter.AuthFilter;
 import de.ids_mannheim.korap.web.filter.DemoUserFilter;
@@ -28,7 +34,8 @@
  * @author margaretha
  *
  */
-@Path(KustvaktServer.API_VERSION + "/annotation/")
+@Controller
+@Path("annotation/")
 @ResourceFilters({ AuthFilter.class, DemoUserFilter.class, PiwikFilter.class })
 @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
 public class AnnotationService {
@@ -36,12 +43,20 @@
     private static Logger jlog = LoggerFactory
             .getLogger(AnnotationService.class);
 
-
+    @Autowired
+    private AnnotationDao annotationDao;
+    
+    /** Returns information about all supported layers
+     * 
+     * @return a json serialization of all supported layers 
+     */
     @GET
     @Path("layers")
     public Response getLayers () {
-        // TODO Auto-generated method stub
-        return Response.status(200).build();
+        List<AnnotationPair> layers = annotationDao.getAllFoundryLayerPairs();
+        String result = JsonUtils.toJSON(layers);
+        jlog.debug("/layers "+layers.toString());
+        return Response.ok(result).build();
     }
 
 
@@ -49,6 +64,7 @@
     @Path("description")
     public Response getAnnotations (@QueryParam("symbol") List<String> symbols,
             String language) {
+        List<AnnotationPair> annotationPairs = null;
         if (language == null || language.isEmpty()) {
             language = "en";
         }
@@ -56,24 +72,31 @@
             throw KustvaktResponseHandler.throwit(StatusCodes.MISSING_ARGUMENT);
         }
         if (symbols.isEmpty() || symbols.contains("*")){
-            // select all 
+            annotationPairs = annotationDao.getAllAnnotationDescriptions(); 
         }
         else {
-            String[] annotationPair;
+            String[] annotationSymbols;
             String foundry, layer;
             
             for (String s : symbols){
-                annotationPair = s.split("/");
-                if (annotationPair.length != 2){
+                annotationSymbols = s.split("/");
+                if (annotationSymbols.length != 2){
                     throw KustvaktResponseHandler.throwit(StatusCodes.PARAMETER_VALIDATION_ERROR);
                 }
-                foundry = annotationPair[0];
-                layer = annotationPair[1];
+                foundry = annotationSymbols[0];
+                layer = annotationSymbols[1];
                 // select
             }
         }
         
-        return Response.status(200).build();
+        if (annotationPairs != null && !annotationPairs.isEmpty()){
+            String result = JsonUtils.toJSON(annotationPairs);
+            jlog.debug("/layers "+annotationPairs.toString());
+            return Response.ok(result).build();
+        }
+        else{
+            return Response.ok().build();
+        }
     }
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
index 9e669b4..5407c35 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
@@ -1,5 +1,6 @@
 package de.ids_mannheim.korap.web.service.full;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.ws.rs.GET;
@@ -13,11 +14,13 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Service;
 
 import com.sun.jersey.spi.container.ResourceFilters;
 
 import de.ids_mannheim.korap.dao.ResourceDao;
+import de.ids_mannheim.korap.dto.ResourceDto;
 import de.ids_mannheim.korap.entity.Resource;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.filter.AuthFilter;
@@ -30,32 +33,24 @@
  * @author margaretha
  *
  */
-@Service
+@Controller
 @Path("resource/")
 @ResourceFilters({ AuthFilter.class, DemoUserFilter.class, PiwikFilter.class })
 @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
 public class ResourceService {
 
     private static Logger jlog = LoggerFactory.getLogger(ResourceService.class);
-    
+
     @Autowired
-    private ResourceDao resourceDao; 
-    
+    private ResourceDao resourceDao;
+
     @GET
     @Path("info")
     public Response getAllResourceInfo () {
         List<Resource> resources = resourceDao.getAllResources();
         String result = JsonUtils.toJSON(resources);
-//        System.out.println(result);
+        jlog.debug("/info " + resources.toString());
         return Response.ok(result).build();
     }
 
-
-    @POST
-    @Path("layers")
-    public Response getResourceLayers (
-            @QueryParam("resourceId") List<String> resourceIds) {
-        // TODO Auto-generated method stub
-        return Response.status(200).build();
-    }
 }
diff --git a/src/main/resources/db/new-mysql/V1__create_tables.sql b/src/main/resources/db/new-mysql/V1__create_tables.sql
index 9c73af8..926db2a 100644
--- a/src/main/resources/db/new-mysql/V1__create_tables.sql
+++ b/src/main/resources/db/new-mysql/V1__create_tables.sql
@@ -1,13 +1,8 @@
 
---type
---0	value
---1	foundry
---2	layer
---3	key
 CREATE TABLE IF NOT EXISTS annotation(
 	id INTEGER PRIMARY KEY AUTO_INCREMENT,
 	symbol VARCHAR(20) NOT NULL,
-	type INTEGER DEFAULT 0,	
+	type VARCHAR(20) NOT NULL,	
 	description VARCHAR(100) NOT NULL,
 	UNIQUE INDEX unique_index (symbol, type)
 );
@@ -31,21 +26,21 @@
 CREATE TABLE IF NOT EXISTS annotation_pair_value(
 	id INTEGER PRIMARY KEY AUTO_INCREMENT,
 	pair_id INTEGER NOT NULL,
-	value INTEGER NOT NULL,
-	UNIQUE INDEX unique_index (pair_id, value),
+	value_id INTEGER NOT NULL,
+	UNIQUE INDEX unique_index (pair_id, value_id),
 	FOREIGN KEY (pair_id)
 		REFERENCES annotation_pair (id)
 		ON DELETE CASCADE,
-	FOREIGN KEY (value)
+	FOREIGN KEY (value_id)
 		REFERENCES annotation (id)
 		ON DELETE CASCADE
 );
 
 CREATE TABLE resource(
 	id VARCHAR(100) PRIMARY KEY UNIQUE NOT NULL,
-	title VARCHAR(100) NOT NULL,
+	de_title VARCHAR(100) NOT NULL,
 	en_title VARCHAR(100) NOT NULL,
-	description VARCHAR(100)	
+	en_description VARCHAR(100)	
 );
 
 CREATE TABLE resource_layer(
diff --git a/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql b/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql
index 12501a8..4131cc4 100644
--- a/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql
+++ b/src/main/resources/db/new-mysql/V2.0__insert_annotations.sql
@@ -1,32 +1,32 @@
 --foundries
-INSERT INTO annotation (symbol, type, description) VALUES("base",1,"Base");
-INSERT INTO annotation (symbol, type, description) VALUES("dereko",1,"DeReKo");
-INSERT INTO annotation (symbol, type, description) VALUES("corenlp",1,"CoreNLP");
-INSERT INTO annotation (symbol, type, description) VALUES("cnx",1,"Connexor");
-INSERT INTO annotation (symbol, type, description) VALUES("drukola",1,"DruKoLa");
-INSERT INTO annotation (symbol, type, description) VALUES("glemm",1,"Glemm");
-INSERT INTO annotation (symbol, type, description) VALUES("malt",1,"Malt");
-INSERT INTO annotation (symbol, type, description) VALUES("marmot",1,"MarMot");
-INSERT INTO annotation (symbol, type, description) VALUES("mate",1,"Mate");
-INSERT INTO annotation (symbol, type, description) VALUES("mdp",1,"MD parser");
-INSERT INTO annotation (symbol, type, description) VALUES("opennlp",1,"OpenNLP");
-INSERT INTO annotation (symbol, type, description) VALUES("sgbr",1,"Schreibgebrauch");
-INSERT INTO annotation (symbol, type, description) VALUES("tt",1,"Tree Tagger");
-INSERT INTO annotation (symbol, type, description) VALUES("xip",1,"Xerox Incremental Parser");
+INSERT INTO annotation (symbol, type, description) VALUES("base","foundry","Base");
+INSERT INTO annotation (symbol, type, description) VALUES("dereko","foundry","DeReKo");
+INSERT INTO annotation (symbol, type, description) VALUES("corenlp","foundry","CoreNLP");
+INSERT INTO annotation (symbol, type, description) VALUES("cnx","foundry","Connexor");
+INSERT INTO annotation (symbol, type, description) VALUES("drukola","foundry","DruKoLa");
+INSERT INTO annotation (symbol, type, description) VALUES("glemm","foundry","Glemm");
+INSERT INTO annotation (symbol, type, description) VALUES("malt","foundry","Malt");
+INSERT INTO annotation (symbol, type, description) VALUES("marmot","foundry","MarMot");
+INSERT INTO annotation (symbol, type, description) VALUES("mate","foundry","Mate");
+INSERT INTO annotation (symbol, type, description) VALUES("mdp","foundry","MD parser");
+INSERT INTO annotation (symbol, type, description) VALUES("opennlp","foundry","OpenNLP");
+INSERT INTO annotation (symbol, type, description) VALUES("sgbr","foundry","Schreibgebrauch");
+INSERT INTO annotation (symbol, type, description) VALUES("tt","foundry","Tree Tagger");
+INSERT INTO annotation (symbol, type, description) VALUES("xip","foundry","Xerox Incremental Parser");
 
 --layers
-INSERT INTO annotation (symbol, type, description) VALUES("c",2,"Constituency");
-INSERT INTO annotation (symbol, type, description) VALUES("d",2,"Dependency");
-INSERT INTO annotation (symbol, type, description) VALUES("p",2,"Part of speech");
-INSERT INTO annotation (symbol, type, description) VALUES("l",2,"Lemma");
-INSERT INTO annotation (symbol, type, description) VALUES("lv",2,"Lemma variant");
-INSERT INTO annotation (symbol, type, description) VALUES("m",2,"Morphology");
-INSERT INTO annotation (symbol, type, description) VALUES("ne",2,"Named entity");
-INSERT INTO annotation (symbol, type, description) VALUES("s",2,"Structure");
-INSERT INTO annotation (symbol, type, description) VALUES("syn",2,"Syntax");
+INSERT INTO annotation (symbol, type, description) VALUES("c","layer","Constituency");
+INSERT INTO annotation (symbol, type, description) VALUES("d","layer","Dependency");
+INSERT INTO annotation (symbol, type, description) VALUES("p","layer","Part of speech");
+INSERT INTO annotation (symbol, type, description) VALUES("l","layer","Lemma");
+INSERT INTO annotation (symbol, type, description) VALUES("lv","layer","Lemma variant");
+INSERT INTO annotation (symbol, type, description) VALUES("m","layer","Morphology");
+INSERT INTO annotation (symbol, type, description) VALUES("ne","layer","Named entity");
+INSERT INTO annotation (symbol, type, description) VALUES("s","layer","Structure");
+INSERT INTO annotation (symbol, type, description) VALUES("syn","layer","Syntax");
 
 --values
-INSERT INTO annotation (symbol, type, description) VALUES("s",0,"Sentence");
-INSERT INTO annotation (symbol, type, description) VALUES("p",0,"Paragraph");
-INSERT INTO annotation (symbol, type, description) VALUES("t",0,"Text");
+INSERT INTO annotation (symbol, type, description) VALUES("s","value","Sentence");
+INSERT INTO annotation (symbol, type, description) VALUES("p","value","Paragraph");
+INSERT INTO annotation (symbol, type, description) VALUES("t","value","Text");
 
diff --git a/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql b/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql
index e2ad49c..9d8963d 100644
--- a/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql
+++ b/src/main/resources/db/new-mysql/V2.2__insert_annotation_pair_values.sql
@@ -1,11 +1,11 @@
-INSERT INTO annotation_pair_value (pair_id, value) 
+INSERT INTO annotation_pair_value (pair_id, value_id) 
 	SELECT 
 		(SELECT ap.id FROM annotation_pair as ap WHERE 
 			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.symbol="base") AND 
 			ap.annotation2 = (SELECT a.id FROM annotation as a WHERE a.description="Structure")), 
 		(SELECT a.id FROM annotation as a WHERE a.description="Sentence");
 		
-INSERT INTO annotation_pair_value (pair_id, value) 
+INSERT INTO annotation_pair_value (pair_id, value_id) 
 	SELECT 
 		(SELECT ap.id FROM annotation_pair as ap WHERE 
 			ap.annotation1 = (SELECT a.id FROM annotation as a WHERE a.symbol="dereko") AND 
diff --git a/src/main/resources/db/new-mysql/V2.3__insert_resources.sql b/src/main/resources/db/new-mysql/V2.3__insert_resources.sql
index 14918c6..0afba04 100644
--- a/src/main/resources/db/new-mysql/V2.3__insert_resources.sql
+++ b/src/main/resources/db/new-mysql/V2.3__insert_resources.sql
@@ -1 +1 @@
-INSERT INTO resource (id, title, en_title) VALUES("WPD15","Deutsche Wikipedia Artikel 2015","English Wikipedia Articles 2015");
+INSERT INTO resource (id, de_title, en_title) VALUES("WPD15","Deutsche Wikipedia Artikel 2015","English Wikipedia Articles 2015");
diff --git a/src/main/resources/hibernate.properties b/src/main/resources/hibernate.properties
index fa35ac7..76c9add 100644
--- a/src/main/resources/hibernate.properties
+++ b/src/main/resources/hibernate.properties
@@ -1,5 +1,5 @@
 hibernate.dialect=org.hibernate.dialect.MySQLDialect
-hibernate.hbm2ddl.auto=create-drop
+hibernate.hbm2ddl.auto=none
 hibernate.show_sql=true
 hibernate.cache.use_query_cache=false
 hibernate.cache.use_second_level_cache=false