Commit 30577587 authored by Valentin Suhnjov's avatar Valentin Suhnjov

Merge branch 'releases/release-0.6.0' into master

parents 3a161c2d 2e1ab4fc
......@@ -5,7 +5,7 @@
<groupId>ee.eesti.riha</groupId>
<artifactId>rest</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
<packaging>war</packaging>
......
......@@ -324,7 +324,7 @@ CREATE TABLE riha.comment
infosystem_uuid UUID,
comment VARCHAR,
author_name VARCHAR(255) NULL,
author_personal_code VARCHAR(11) NULL,
author_personal_code VARCHAR(13) NULL,
organization_name VARCHAR(255) NULL,
organization_code VARCHAR(50) NULL,
status VARCHAR(150) NULL,
......
ALTER TABLE riha.comment ALTER COLUMN author_personal_code TYPE VARCHAR(13);
\ No newline at end of file
......@@ -514,7 +514,7 @@ public class ApiGenericDAOImpl<T, K> implements ApiGenericDAO<T, K> {
if (JsonContentBasedTable.isJsonContentBasedTable(clazz)) {
return updateJsonContentEntity(existing, newValue);
} else {
return updateEntity(newValue);
return updateEntity(existing, newValue);
}
}
......@@ -554,9 +554,18 @@ public class ApiGenericDAOImpl<T, K> implements ApiGenericDAO<T, K> {
return 1;
}
private int updateEntity(T updatedEntity) {
private int updateEntity(T existing, T updatedEntity) {
Session session = sessionFactory.getCurrentSession();
session.merge(updatedEntity);
try {
copyNotNullValues(existing, updatedEntity);
session.update(existing);
} catch (IntrospectionException | IllegalAccessException | InvocationTargetException e) {
LOG.error("Failed to update entity {}", existing);
LOG.debug("Failed to update entity", e);
return 0;
}
return 1;
}
......
......@@ -146,6 +146,7 @@ public class Comment implements BaseModel {
*
* @param aComment_parent_id the new comment_parent_id
*/
@DisallowUseMethodForUpdate
public void setComment_parent_id(Integer aComment_parent_id) {
comment_parent_id = aComment_parent_id;
}
......@@ -301,6 +302,7 @@ public class Comment implements BaseModel {
return author_name;
}
@DisallowUseMethodForUpdate
public void setAuthor_name(String author_name) {
this.author_name = author_name;
}
......@@ -309,6 +311,7 @@ public class Comment implements BaseModel {
return author_personal_code;
}
@DisallowUseMethodForUpdate
public void setAuthor_personal_code(String author_personal_code) {
this.author_personal_code = author_personal_code;
}
......@@ -317,6 +320,7 @@ public class Comment implements BaseModel {
return organization_name;
}
@DisallowUseMethodForUpdate
public void setOrganization_name(String organization_name) {
this.organization_name = organization_name;
}
......@@ -325,6 +329,7 @@ public class Comment implements BaseModel {
return organization_code;
}
@DisallowUseMethodForUpdate
public void setOrganization_code(String organization_code) {
this.organization_code = organization_code;
}
......@@ -341,6 +346,7 @@ public class Comment implements BaseModel {
return type;
}
@DisallowUseMethodForUpdate
public void setType(String type) {
this.type = type;
}
......@@ -349,6 +355,7 @@ public class Comment implements BaseModel {
return sub_type;
}
@DisallowUseMethodForUpdate
public void setSub_type(String sub_type) {
this.sub_type = sub_type;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment