Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationAffiliation.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationAffiliation.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationAffiliation.java	(nonexistent)
@@ -1,45 +0,0 @@
-package eu.dnetlib.goldoa.domain;
-
-import java.io.Serializable;
-import javax.persistence.*;
-
-
-/**
- * The persistent class for the publication_affiliation database table.
- * 
- */
-@Entity
-@Table(name="publication_affiliation")
-public class PublicationAffiliation implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	@Id
-	@ManyToOne
-    @JoinColumn(name = "affiliation")
-	private Affiliation affiliation;
-
-	@Id
-	@ManyToOne
-    @JoinColumn(name = "publication")
-	private Publication publication;
-
-	public PublicationAffiliation() {
-	}
-
-	public Affiliation getAffiliation() {
-		return this.affiliation;
-	}
-
-	public void setAffiliation(Affiliation affiliation) {
-		this.affiliation = affiliation;
-	}
-
-	public Publication getPublication() {
-		return this.publication;
-	}
-
-	public void setPublication(Publication publication) {
-		this.publication = publication;
-	}
-
-}
\ No newline at end of file
Index: modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/ManageRequestsTest.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/ManageRequestsTest.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/ManageRequestsTest.java	(revision 46741)
@@ -109,13 +109,17 @@
     @Test
     @Transactional
     @Rollback(true)
-    public void savePublicationAndPublisherInfo() {
+    public void savePublicationAndPublisherInfo() throws PersonManagerException, OrganizationManagerException {
         try {
             Publication p = pum.resolveDOI("10.1038/srep12540");
-            System.out.println(p.getJournal().getId());
-            System.out.println("Authors list size -> " + p.getAuthors().size());
-            System.out.println("Author -> " + p.getAuthors().get(0).getFirstname());
-            pum.savePublication(p);
+           // pum.savePublication(p);
+
+            Request r  = new Request();
+            r.setUser(um.getByEmail("pkanakakis@di.uoa.gr"));
+            r.setPublication(pum.getPublication("portal::d48191df0a20dfff1d1332574440ff29"));
+            r.setJournal(p.getJournal());
+            r.setOrganization(om.getById("corda::999643007"));
+            rm.saveRequest(r);
         } catch (ManagerException e) {
             e.printStackTrace();
         }
Index: modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/StatisticsTest.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/StatisticsTest.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/StatisticsTest.java	(revision 46741)
@@ -3,10 +3,8 @@
 import com.google.gwt.i18n.client.NumberFormat;
 import com.google.gwt.user.client.Window;
 import eu.dnetlib.goldoa.domain.OrganizationManagerException;
-import eu.dnetlib.goldoa.domain.stats.Browse;
-import eu.dnetlib.goldoa.domain.stats.DateSeries;
-import eu.dnetlib.goldoa.domain.stats.Numbers;
-import eu.dnetlib.goldoa.domain.stats.Triple;
+import eu.dnetlib.goldoa.domain.Request;
+import eu.dnetlib.goldoa.domain.stats.*;
 import eu.dnetlib.goldoa.service.OrganizationManager;
 import eu.dnetlib.goldoa.service.stats.StatsManager;
 import eu.dnetlib.goldoa.service.stats.StatsManagerImpl;
@@ -36,6 +34,7 @@
     OrganizationManager om;
 
 
+
     @Test
     @Transactional
     @Rollback(true)
@@ -114,4 +113,37 @@
 
     }
 
+
+    @Test
+    @Transactional
+    @Rollback(true)
+    public void statsData() {
+
+        Numbers rs = st.getNumbers(new Numbers.Category[]{Numbers.Category.REQUESTS, Numbers.Category.PROJECTS,
+                Numbers.Category.TOTAL_AMOUNT, Numbers.Category.AVERAGE_AMOUNT, Numbers.Category.AVERAGE_PER_ARTICLE,
+                Numbers.Category.AVERAGE_PER_MONOGRAPH, Numbers.Category.AVERAGE_PER_BOOK_CHAPTER, Numbers.Category.PAID_REQUESTS,
+                Numbers.Category.PAID_REQUESTS_WITH_DOI, Numbers.Category.APPROVED_REQUESTS_WITH_DOI, Numbers.Category.PAID_ARTICLE_REQUESTS,
+                Numbers.Category.PAID_MONOGRAPH_REQUESTS, Numbers.Category.PAID_BOOK_CHAPTER_REQUESTS});
+
+        Series fundedRequests = st.getSeries(new Series.Category[] {Series.Category.COUNTRY, Series.Category.ORGANIZATION,
+                Series.Category.PUBLISHER}, new Request.RequestStatus[] {Request.RequestStatus.CONDITIONALLY_APPROVED,
+                Request.RequestStatus.APPROVED, Request.RequestStatus.ACCOUNTING_PROCESSING, Request.RequestStatus.ACCOUNTING_PAID,
+                Request.RequestStatus.ACCOUNTING_ON_HOLD});
+        Series rejectedRequests = st.getSeries(new Series.Category[] {Series.Category.COUNTRY, Series.Category.ORGANIZATION,
+                Series.Category.PUBLISHER}, new Request.RequestStatus[] {Request.RequestStatus.REJECTED,
+                Request.RequestStatus.ACCOUNTING_DENIED});
+
+        DateSeries result = st.getDateSeries(DateSeries.Over.DAY, false, null, null, null, null, null, null);
+        result = st.getDateSeries(DateSeries.Over.DAY, true,null, null, null, null, null, null);
+
+        st.getSeries(new Series.Category[] {Series.Category.STATUS}, null);
+
+    }
+
+
+
+
+
+
+
 }
\ No newline at end of file
Index: modules/uoa-goldoa-service/branches/hibernate/src/test/resources/hibernate-cfg.xml
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/test/resources/hibernate-cfg.xml	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/test/resources/hibernate-cfg.xml	(revision 46741)
@@ -8,7 +8,6 @@
 <hibernate-configuration>
     <session-factory>
         <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL9Dialect</property>
-
         <property name="show_sql">true</property>
        	<property name="connection.pool_size">1</property>
      	<property name="format_sql">true</property>
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/RequestManagerImpl.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/RequestManagerImpl.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/RequestManagerImpl.java	(revision 46741)
@@ -2,8 +2,11 @@
 
 import eu.dnetlib.goldoa.domain.*;
 import eu.dnetlib.goldoa.service.dao.RequestDAO;
+import eu.dnetlib.goldoa.service.dao.UserDAO;
 import eu.dnetlib.goldoa.service.utils.EmailUtils;
 import net.sf.ehcache.search.expression.Or;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.stereotype.Service;
@@ -52,14 +55,20 @@
 	private boolean sendCoordinatorEmails = false;
 	private boolean sendEvaEmail = false;
 	private String evaEmail = null;
-
+	private Log logger = LogFactory.getLog(RequestManagerImpl.class);
 	@Override
 	public Request saveRequest(final Request request) {
 
+
+		logger.debug("saving request " + request.getId() + " with status " + request.getStatus());
 		if (request.getId() == null) {
 			request.setId(new SimpleDateFormat("yyyyMMdd-").format(new Date()) + requestDAO.getRequestId());
-			Budget budget = budgetManager.getForRequest(request.getOrganization().getId(),
-                                            request.getPublisher().getEmail());
+			Budget budget = null;
+			logger.debug("Request publisher -> " + request.getPublisher());
+			if(request.getPublisher() != null)
+				budget = budgetManager.getForRequest(request.getOrganization().getId(),
+						request.getPublisher().getEmail());
+
 			if (budget != null) {
 				request.setBudget(budget);
 				// TODO fix amounts
@@ -67,7 +76,7 @@
 //				budgetManager.saveBudget(budget);
 			}
 		}
-		System.out.println("saving request " + request.getId() + " with status " + request.getStatus());
+		logger.debug("saving request " + request.getId() + " with status " + request.getStatus());
 		requestDAO.saveRequest(request);
 		return request;
 	}
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/dao/RequestDAO.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/dao/RequestDAO.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/dao/RequestDAO.java	(revision 46741)
@@ -4,6 +4,8 @@
 import eu.dnetlib.goldoa.domain.*;
 import eu.dnetlib.goldoa.domain.RequestPage;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hibernate.Criteria;
 import org.hibernate.criterion.*;
 import org.springframework.stereotype.Repository;
@@ -25,12 +27,25 @@
 @Repository
 public class RequestDAO extends AbstractDao<String,Request>{
 
-
+	private Log logger = LogFactory.getLog(RequestDAO.class);
 	private final static String GET_COMMENT_TEMPLATES = "select id, status, name, comment from commenttemplate where status=?";
 
 
 	public void saveRequest(final Request request) {
-		persist(request);
+
+		logger.debug("Save request with id -> " + request.getId());
+
+
+		Request r = getRequest(request.getId());
+		logger.debug("Find request -> " + r);
+		Request r_merged = null;
+
+		if(r != null)
+			r_merged = (Request)getSession().merge(request);
+		else
+			persist(request);
+
+		logger.debug("Request saved with id -> " + request.getId());
 	}
 
 
@@ -38,6 +53,7 @@
 	    return request.getRequestCoFunders();
 	}
 
+	@SuppressWarnings("unchecked")
 	public Request getRequest(String requestId) {
 	   List<Request> r = createEntityCriteria().add(Restrictions.eq("id",requestId)).list();
 	   if(r.size() > 0)
@@ -205,8 +221,8 @@
         return this.getRequestPage(null, null, null, requestSortBy, order, requestFilter, term, statusFilter, from, to);
     }
 
-	public int getRequestId() {
-		return getSession().createQuery("select nextval('request_id_seq') as id").getFirstResult();
+	public BigInteger getRequestId() {
+		return (BigInteger) getSession().createSQLQuery("select nextval('request_id_seq') as id").list().get(0);
 	}
 
 	@SuppressWarnings("unchecked")
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/dao/PublicationDAO.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/dao/PublicationDAO.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/dao/PublicationDAO.java	(revision 46741)
@@ -1,14 +1,10 @@
 
 package eu.dnetlib.goldoa.service.dao;
 
-import eu.dnetlib.goldoa.domain.Affiliation;
-import eu.dnetlib.goldoa.domain.Journal;
-import eu.dnetlib.goldoa.domain.Organization;
-import eu.dnetlib.goldoa.domain.Publication;
-import eu.dnetlib.goldoa.domain.Identifier;
-import eu.dnetlib.goldoa.domain.Publisher;
+import eu.dnetlib.goldoa.domain.*;
 import eu.dnetlib.goldoa.service.PublicationManagerImpl;
 import eu.dnetlib.goldoa.service.UserManagerImpl;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.log4j.Logger;
 import org.hibernate.criterion.Restrictions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +24,7 @@
 
 	private static Logger logger = Logger.getLogger(PublicationDAO.class);
 
+	@SuppressWarnings("unchecked")
 	public Publication getPublication(final String publicationId) {
         List<Publication> ps = createEntityCriteria().add(Restrictions.eq("id",publicationId)).list();
         if(ps.size() > 0)
@@ -37,87 +34,19 @@
 
 	public Publication savePublication(Publication publication) {
 
+		for(Author a : publication.getAuthors())
+			a.setId(DigestUtils.md5Hex(a.getFirstname() + a.getEmail()) + publication.getId());
+		
 		Publication p = getPublication(publication.getId());
 		Publication pub_merged = null;
 
-		logger.debug("publication id -> " + p.getId());
-		logger.debug("publication id -> " + publication.getId());
 		if(p!=null)
 			pub_merged = (Publication) getSession().merge(publication);
 		else
 			persist(publication);
 
+
 		return publication;
 	}
 
-	public void deleteAffiliations(Publication publication) {
-      //  publication.setAffiliations(null);
-        // savePublication(publication);
-    }
-
-	public void deleteIdentifiers(Publication publication) {
-		//new JdbcTemplate(dataSource).update("delete from publication_identifier where publication=?", new String[]{publication.getId()}, new int[]{Types.VARCHAR});
-	}
-
-	public void saveAffiliations(final Publication publication) {
-		/*JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
-
-		if (publication.getAuthors() != null) {
-			for (Affiliation affiliation : publication.getAuthors()) {
-				if (jdbcTemplate.update(UPDATE_PUBLICATION_AFFILIATIONS, new String[]{affiliation.getUser().getId(), affiliation.getOrganization() != null ? affiliation.getOrganization().getId() : null, publication.getId()}, new int[]{Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}) == 0) {
-					jdbcTemplate.update(INSERT_PUBLICATION_AFFILIATIONS,
-							new Object[]{UserManagerImpl.generateId(affiliation), affiliation.getUser().getId(), affiliation.getOrganization() != null ? affiliation.getOrganization().getId() : null, affiliation.getStart(), affiliation.getEnd(), affiliation.getDepartment(), publication.getId()},
-							new int[]{	Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.TIMESTAMP, Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR});
-				}
-			}
-		}*/
-	}
-
-	public void loadAffiliations(Publication publication) {
-		/*List<Affiliation> affiliations = new JdbcTemplate(dataSource).query(LOAD_AFFILIATIONS, new String[]{publication.getId()}, new int[]{Types.VARCHAR}, new RowMapper<Affiliation>() {
-			@Override
-			public Affiliation mapRow(	ResultSet rs, int rowNum) throws SQLException {
-				Affiliation aff = new Affiliation();
-
-				aff.setId(rs.getInt("id"));
-				aff.setDepartment(rs.getString("department"));
-				aff.setStart(rs.getDate("startdate"));
-				aff.setEnd(rs.getDate("enddate"));
-
-				aff.setPerson(this.parsePerson(rs.getString("person")));
-				aff.setOrganization(th	is.parseOrganisation(rs.getString("organisation")));
-
-				return aff;
-			}
-
-			private Organization parseOrganisation(String organisation) {
-				if (organisation != nu	ll) {
-					Organization org = new Organization();
-					String[] parts = organisation.split("\\|\\|");
-
-					org.setId(parts[0]);
-					org.setName(parts[1]);
-
-					return org;
-				} else
-					return null;
-			}
-
-			private Person parsePerson(String pStr) {
-				String[] parts = pStr.split("\\|\\|");
-				Person person = new Person();
-
-				person.setId(parts[0]);
-				person.setEmail(parts[1]);
-				person.setName(parts[2]);
-				person.setLastname(parts[3]);
-				if (parts.length > 4)
-					person.setInitials(parts[4]);
-
-				return person;
-			}
-		});
-
-		publication.setAuthors(affiliations);*/
-	}
 }
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/PublicationManagerImpl.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/PublicationManagerImpl.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/PublicationManagerImpl.java	(revision 46741)
@@ -47,11 +47,7 @@
 	public Publication getPublication(String publicationId) {
 	    return publicationDAO.getPublication(publicationId);
 	}
-
-	private void loadPublicationRelations(Publication publication) {
-		publicationDAO.loadAffiliations(publication);
-	}
-
+	
 	@Override
 	public Publication savePublication(Publication publication) {
 
@@ -80,59 +76,9 @@
 			//System.out.println(publication.getPublisher().getId());
 			//publication.setPublisher(publisherManager.getPublisher(publication.getPublisher().getId()));
 		}*/
-		publicationDAO.savePublication(publication);
-		return publication;
+		return publicationDAO.savePublication(publication);
 	}
 
-	private void insertPublicationRelations(Publication publication) throws PersonManagerException, OrganizationManagerException {
-		/*publicationDAO.insertIdentifiers(publication);
-
-		if (publication.getAuthors() != null)
-			for (Affiliation aff : publication.getAuthors()) {
-				if (aff.getOrganization() != null && aff.getOrganization().getId() == null)
-					aff.getOrganization().setId(organizationManager.saveOrganization(aff.getOrganization()));
-
-				if (aff.getUser() != null) {
-					String personId = personManager.generateId(aff.getUser());
-
-					try {
-						boolean affiliationExists = false;
-						Person temp = personManager.getById(personId);
-
-						for (Affiliation a : temp.getAffiliations()) {
-							if (a.getOrganization() != null && aff.getOrganization() != null && a.getOrganization().getId().equals(aff.getOrganization().getId()))
-								affiliationExists = true;
-						}
-
-						if (!affiliationExists) {
-							temp.getAffiliations().add(aff);
-
-							personManager.saveUser(temp);
-						}
-
-						aff.setPerson(temp);
-					} catch (PersonManagerException e) {
-						if (e.getErrorCause() == PersonManagerException.ErrorCause.NOT_EXISTS) {
-							List<Affiliation> affiliations = new ArrayList<Affiliation>();
-
-							affiliations.add(aff);
-
-							aff.getUser().setAffiliations(affiliations);
-
-							personManager.saveUser(aff.getUser());
-						}
-					}
-				}
-			}
-
-		publicationDAO.saveAffiliations(publication);*/
-	}
-
-	private void deletePublicationRelations(Publication publication) {
-		//publicationDAO.deleteIdentifiers(publication);
-		//publicationDAO.deleteAffiliations(publication);
-	}
-
 	@Override
 	public Publication resolveDOI(String doi) throws ManagerException {
 		Publication publication = null;
@@ -147,7 +93,6 @@
 				publication.setTitle(root.path("message").path("title").path(0).textValue());
 				publication.setDoi(doi);
 				publication.setSubjects(root.path("message").path("subject").textValue());
-
 				publication.setSource("crossref");
 				publication.setId("crossref::" + DigestUtils.md5Hex(doi));
 
@@ -159,15 +104,11 @@
 				publication.setDate(this.parsePublicationDate(root.path("message").path("issued")));
 				publication.setJournal(this.parseJournal(root.path("message").path("container-title"), root.path("message").path("ISSN")));
 				publication.getJournal().setPublisher(this.parsePublisher(root.path("message").path("publisher")));
-				publication.setAuthors(new ArrayList<Author>());
 
-				for (JsonNode author : root.path("message").path("author")) {
+				for (JsonNode author : root.path("message").path("author"))
 					publication.getAuthors().add(this.parseAffiliation(author,publication));
-				}
 
 				publication.setLicense(root.path("message").path("license").path(0).path("URL").textValue());
-
-				publication.setIdentifiers(new ArrayList<Identifier>());
 				publication.getIdentifiers().add(new Identifier("doi", doi));
 			} else {
 				throw new ManagerException(ManagerException.ErrorCause.NOT_EXISTS);
@@ -189,17 +130,12 @@
 	}
 
 	private Author parseAffiliation(JsonNode author,Publication publication) {
+		Author a = new Author();
 
-		Author a = new Author();
-		//TODO get email
-		//a.setEmail();
 		a.setFirstname(author.path("given").textValue());
 		a.setLastname(author.path("family").textValue());
 		a.setId(DigestUtils.md5Hex(a.getFirstname() + a.getEmail()) + publication.getId());
 		return a;
-
-
-
 	}
 
 	private Publisher parsePublisher(JsonNode publisherName) {
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/stats/StatsManagerImpl.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/stats/StatsManagerImpl.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/stats/StatsManagerImpl.java	(revision 46741)
@@ -15,6 +15,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -176,6 +177,11 @@
 			Quadruple<String, Integer, Float, Float> q = null;
 			List<Quadruple<String, Integer, Float, Float>> l = new ArrayList<>();
 			for(Object[] rs : resultSet){
+				System.out.println(rs[0] + "/" + rs[1] + "/" + rs[2] + "/" + rs[3] );
+
+				if(rs[2] == null) rs[2] = "0.0";
+				if(rs[3] == null) rs[3] = "0.0";
+				
 				if(category != Series.Category.STATUS)
 					q = new Quadruple<>(rs[0].toString(),
 							Integer.parseInt(rs[1].toString()), Float.parseFloat(rs[2].toString()), Float.parseFloat(rs[3].toString()));
@@ -314,10 +320,21 @@
 
 		List<Object[]> resultSet = sessionFactory.getCurrentSession().createSQLQuery(sb.toString()).list();
 		List<Triple<Date, Integer, Float>> l = new ArrayList<>();
+
+		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.s");
 		for(Object[] rs : resultSet){
-			Triple<Date, Integer, Float> t = new Triple<Date,Integer, Float>(new Date(rs[0].toString()),
-					Integer.parseInt(rs[1].toString()),Float.parseFloat(rs[2].toString()));
-			l.add(t);
+			//System.out.println(rs[0] + "/" + rs[1] + "/" + rs[2]);
+			Date date = null;
+			try {
+				date = formatter.parse(rs[0].toString());
+				if(rs[2] == null)
+					rs[2] = "0.0";
+				Triple<Date, Integer, Float> t = new Triple<Date,Integer, Float>(date,
+						Integer.parseInt(rs[1].toString()),Float.parseFloat(rs[2].toString()));
+				l.add(t);
+			} catch (ParseException e) {
+				e.printStackTrace();
+			}
 		}
 		return new DateSeries(l);
 
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationType.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationType.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationType.java	(revision 46741)
@@ -11,6 +11,22 @@
         BOOK_CHAPTER("book chapter"),
         CONFERENCE_PROCS("Conference Procs");
 
+        public static PublicationType getEnum(String code) {
+                switch (code) {
+                        case "article":
+                                return ARTICLE;
+                        case "monograph":
+                                return MONOGRAPH;
+                        case "book chapter":
+                                return BOOK_CHAPTER;
+                        case "Conference Procs":
+                                return CONFERENCE_PROCS;
+                        default:
+                                return null;
+                }
+        }
+
+
         private String type;
 
         PublicationType(String type) {
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationConverter.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationConverter.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/PublicationConverter.java	(revision 46741)
@@ -21,6 +21,8 @@
         if ( value == null ) {
             return null;
         }
+        if(PublicationType.getEnum(value) != null)
+            return PublicationType.getEnum(value);
         return PublicationType.valueOf(value);
     }
 }
\ No newline at end of file
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Author.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Author.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Author.java	(revision 46741)
@@ -1,5 +1,7 @@
 package eu.dnetlib.goldoa.domain;
 
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
@@ -8,6 +10,7 @@
 
 
 @Entity
+@Table(name = "author")
 public class Author implements Serializable{
 	private static final long serialVersionUID = 1L;
 
@@ -35,6 +38,7 @@
 	private Organization organization;
 
 	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "authors")
+	@JsonBackReference(value = "publications")
 	private List<Publication> publications = new ArrayList<>();
 
 	public Author() {}
Index: modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Publication.java
===================================================================
--- modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Publication.java	(revision 46740)
+++ modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Publication.java	(revision 46741)
@@ -1,5 +1,7 @@
 package eu.dnetlib.goldoa.domain;
 
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
 import java.io.Serializable;
 import javax.persistence.*;
 
@@ -13,6 +15,7 @@
  * 
  */
 @Entity
+@Table(name = "publication")
 public class Publication implements Serializable {
 	private static final long serialVersionUID = 1L;
 
@@ -45,19 +48,7 @@
 	@Column(columnDefinition = "text")
 	private String license;
 
-	@OneToOne
-	@JoinColumn(name = "journal")
-	private Journal journal;
 
-	@OneToOne
-	@JoinColumn(name = "publisher")
-	private Publisher publisher;
-
-	@Basic
-	@Convert(converter=PublicationConverter.class)
-	private PublicationType type;
-
-
 	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
 	@JoinTable(name = "publication_author",  joinColumns = {
 			@JoinColumn(name = "publication", nullable = false, updatable = false),},
@@ -73,6 +64,20 @@
 					nullable = false, updatable = false) })
 	private List<Identifier> identifiers = new ArrayList<>();
 
+	@OneToOne
+	@JoinColumn(name = "journal")
+	private Journal journal;
+
+	@OneToOne
+	@JoinColumn(name = "publisher")
+	private Publisher publisher;
+
+	@Basic
+	@Convert(converter=PublicationConverter.class)
+	private PublicationType type;
+
+
+
 	public Publication() { }
 
 	public Date getAcceptancedate() {
