我正在尝试通过两个“ WHERE CLAUSES”获取数据。但是我发现数据只是在行表上首先根据数据计数进行循环。我如何获得这种情况下的所有数据?
This is with spring boot, jpa hibernate, using @NamedQuery
@Entity
@Table(name = "m_account")
@NamedQueries(
{
@NamedQuery(name="findByAccountSegment4IDNullAndAccountFlagAndAccountCompanyId", query = "FROM MAccount e "
+ "WHERE e.accountSegment4ID IS NULL AND e.accountFlag = ?1 AND e.accountCompanyId = ?2"),
@NamedQuery(name="findByAccountCompanyIdAndAccountFlag", query = "FROM MAccount e WHERE e.accountCompanyId = ?1 AND e.accountFlag = ?2 "),
@NamedQuery(name="findByAccountCompanyId", query = "FROM MAccount e WHERE e.accountCompanyId = ?1")
}
)
public class MAccount {
@Id
@Column(name = "account_companyid")
private String accountCompanyId;
@Column(name = "account_id")
@NotEmpty(message = "Account Id can not be empty")
private String accountId;
@Column(name = "account_name")
@NotEmpty(message = "Account Name can not be empty")
private String accountName;
@Column(name = "account_segment4id")
@NotEmpty(message = "Account Segment 4 id can not be empty")
private String accountSegment4ID;
@Column(name = "account_segment4consolid")
@NotEmpty(message = "Account Segment 4 consolidasi can not be empty")
private String accountSegment4Consolidasi;
@Column(name = "account_normalaccount")
@NotEmpty(message = "AccountNormal can not be empty")
private String accountNormal;
@Column(name = "account_activeyn")
@NotEmpty(message = "AccountFlag can not be empty")
private String accountFlag;
@Column(name = "account_userid")
@NotNull(message = "Account Users can not be empty")
private int accountUserId;
@Column(name = "account_lastupdate")
@NotEmpty(message = "Account last update can not be empty")
private String accountLastUpdate;
结果只是第一行。像这样:
{
"status": "00",
"message": "Success",
"data": [
{
"accountCompanyId": "6000",
"accountId": "51101011001",
"accountName": "Kas Pusat",
"accountSegment4ID": "5110101",
"accountSegment4Consolidasi": "5110101",
"accountNormal": "D",
"accountFlag": "N",
"accountUserId": 1,
"accountLastUpdate": "2019-07-11 23:04:10"
},
{
"accountCompanyId": "6000",
"accountId": "51101011001",
"accountName": "Kas Pusat",
"accountSegment4ID": "5110101",
"accountSegment4Consolidasi": "5110101",
"accountNormal": "D",
"accountFlag": "N",
"accountUserId": 1,
"accountLastUpdate": "2019-07-11 23:04:10"
}
]
}