Commit 6fec5f23 by Jan Hrabal

sql

parent ac125b9b
package com.jh.boot.document;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.jh.boot.jpa.AbstractIdEntity;
@Entity
@Table(name = "LEGAL_DOCUMENT")
public class LegalDocument extends AbstractIdEntity {
private static final long serialVersionUID = 1L;
@Column(name = "CODE")
private String code;
@Column(name = "LOCALE")
private String locale;
private String text;
@Column(name = "CONTENT")
private String content;
public LegalDocument() {
}
......@@ -19,7 +28,7 @@ public class LegalDocument extends AbstractIdEntity {
super();
this.code = code;
this.locale = locale;
this.text = text;
this.content = text;
}
public String getCode() {
......@@ -38,12 +47,12 @@ public class LegalDocument extends AbstractIdEntity {
this.locale = locale;
}
public String getText() {
return text;
public String getContent() {
return content;
}
public void setText(String text) {
this.text = text;
public void setContent(String text) {
this.content = text;
}
}
......@@ -21,8 +21,8 @@ public class LegalDocumentRepository extends AbstractHibernateRepository {
locale = locale.replace("-", "_");
Query q = entityManager.createQuery("select ld from LegalDocument ld where lower(ld.code) = :code and lower(ld.locale) = :locale");
q.setParameter("code", locale.trim().toLowerCase());
q.setParameter("locale", locale.trim().toLowerCase());
q.setParameter("code", code.toLowerCase());
q.setParameter("locale", locale.toLowerCase());
LegalDocument ld = singleResult(q);
if (ld == null) {
......@@ -33,7 +33,7 @@ public class LegalDocumentRepository extends AbstractHibernateRepository {
}
}
return null;
return ld;
}
......
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