18 package org.turro.financials.entity;
20 import java.util.Collections;
21 import java.util.List;
22 import javax.persistence.*;
23 import org.turro.financials.db.FinancialsPU;
33 @GeneratedValue(strategy=GenerationType.IDENTITY)
34 @Column(name=
"IDENTIFIER")
37 private String account;
39 private String description;
51 this.account = account;
55 return bookDefinition;
59 this.bookDefinition = bookDefinition;
65 "select m from MajorAccount as m " +
66 "where m.account like '" + account +
"_' " +
68 " select re from RegisterEntry as re " +
69 " where re.account.id like concat(m.account, '%') " +
71 "order by m.account");
74 return Collections.EMPTY_LIST;
82 this.description = description;
102 if(account !=
null && account.length() > 1) {
104 "select m from MajorAccount as m where m.account = '" +
105 account.substring(0, account.length() - 1)+
"' " +
106 "order by m.account");
115 if(account !=
null) {
117 "select a from Account as a " +
119 " select ma from MajorAccount as ma " +
120 " where ma.account = '" + account +
"' " +
121 " and a.id like concat(ma.account, '_%') " +
122 " and not exists ( " +
123 " select ma2 from MajorAccount as ma2 " +
124 " where ma2.account like concat(ma.account, '0%') " +
129 return Collections.EMPTY_LIST;
133 if(account !=
null && account.length() > 1) {
135 "select m from MajorAccount as m where m.account = '" +
void setBookDefinition(BookDefinition bookDefinition)
List< Account > getAccounts()
static MajorAccount getMajor(String account)
List< MajorAccount > getDescendants()
void setDescription(String description)
BookDefinition getBookDefinition()
void setType(MajorAccountType type)
MajorAccountType getType()
void setAccount(String account)
Object getSingleResult(WhereClause wc)