Я хотел проверить, правильно ли получены мои данные из базы данных или нет.У меня есть два класса Transaction и FixedTransaction, контроллеры для обоих и DatabaseService.В fixedTransaction у меня есть правильный getter.
Я встречаюсь:
javax.el.PropertyNotFoundException: Property [fixedTransactionIdentity] not
found on type [com.mybudget.entity.Transaction]
Хотя здесь есть ссылка на класс FixedTransaction:
<c:forEach var="fixedTransaction" items="${allFixedTransactions}">
Я понятия не имею, где проблема,
@Entity
@Table(name = "fixed_transaction")
@NamedQueries({
@NamedQuery(name ="get_all_fixed_transactions", query = "select ft from
FixedTransaction ft")
})
public class FixedTransaction {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id_fixed_transaction")
private int fixedTransactionId;
@Column(name = "amount")
private BigDecimal fixedMoneyAmount;
@Column(name = "begin_date")
private Date durationBeginDate;
@Column(name = "end_date")
private Date durationEndDate;
@Column(name = "comment")
private String transactionComment;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "id_user")
private User fixedTransactionUser;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "id_category")
private Category fixedTransactionsInCategory;
public FixedTransaction(){}
public FixedTransaction(BigDecimal fixedMoneyAmount, Date durationBeginDate, Date durationEndDate, String transactionComment) {
this.fixedMoneyAmount = fixedMoneyAmount;
this.durationBeginDate = durationBeginDate;
this.durationEndDate = durationEndDate;
this.transactionComment = transactionComment;
}
public int getFixedTransactionId() {
return fixedTransactionId;
}
}
Мой фрагмент .jsp, в котором показаны две таблицы, но я добавляю только FixedTransactions:
<p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Amount</th>
<th>Flow date</th>
<th>Description</th>
</tr>
</thead>
<tbody
<c:forEach var="transaction" items="${allTransactionsList}">
<tr>
<td>${transaction.transactionId}</td>
<td>${transaction.moneyAmount}</td>
<td>${transaction.transactionDate}</td>
<td>${transaction.description}</td>
</tr>
</c:forEach>
</tbody>
</table>
</p>
<p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Amount</th>
<th>Begin Date</th>
<th>End Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody
<c:forEach var="fixedTransaction" items="${allFixedTransactions}">
<tr>
<td>${fixedTransaction.fixedTransactionId}</td>
<td>${fixedTransaction.fixedMoneyAmount}</td>
<td>${fixedTransaction.durationBeginDate}</td>
<td>${fixedTransaction.durationEndDate}</td>
<td>${fixedTransaction.transactionComment}</td>
</tr>
</c:forEach>
</tbody>
</table>
</p>
И контроллер для FixedTransaction:
import com.mybudget.services.DatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/fixedTransaction")
public class FixedTransactionController {
@Autowired
DatabaseService databaseService;
@GetMapping("/fixedList")
public String fixedTransactionsList(Model theModel){
theModel.addAttribute("allFixedTransactions",databaseService
.getAllFixedTransactions());
return "test-main-page";
}
}