Author: echatellier Date: 2012-06-06 15:36:02 +0200 (Wed, 06 Jun 2012) New Revision: 3447 Url: http://chorem.org/repositories/revision/lima/3447 Log: Fix queries Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2012-06-05 16:05:09 UTC (rev 3446) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2012-06-06 13:36:02 UTC (rev 3447) @@ -112,7 +112,7 @@ Date endDate) throws TopiaException { String query = "FROM " + ClosedPeriodicEntryBook.class.getName() + - " WHERE :begindate <= financialPeriod.beginDate " + + " WHERE :beginDate <= financialPeriod.beginDate " + " AND financialPeriod.beginDate <= :endDate" + " ORDER BY entryBook.code"; return context.find(query, "beginDate", beginDate, "endDate", endDate); Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-06-05 16:05:09 UTC (rev 3446) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-06-06 13:36:02 UTC (rev 3447) @@ -108,8 +108,8 @@ public List<Entry> findAllEntryOfBalancedTransaction(EntryBook entryBook, Date beginDate, Date endDate) throws TopiaException { String query = getEquilibredTransactionQuery(beginDate, endDate) + - // concerne le compte - " AND E = :entryBook" + + // concerne le journal + " AND E.financialTransaction.entryBook = :entryBook" + // fix order " ORDER BY E.financialTransaction.transactionDate, E.financialTransaction.topiaId"; @@ -132,8 +132,8 @@ Date beginDate, Date endDate) throws TopiaException { String query = "SELECT E.debit, sum(E.amount) " + getEquilibredTransactionQuery(beginDate, endDate) + - // concerne le compte - " AND E = :entryBook" + + // concerne le journal + " AND E.financialTransaction.entryBook = :entryBook" + " GROUP BY E.debit"; List<Object[]> result = context.find(query, "beginDate", beginDate, @@ -156,8 +156,8 @@ // entre les 2 dates " WHERE :beginDate <= E.financialTransaction.transactionDate" + " AND E.financialTransaction.transactionDate <= :endDate" + - // concerne le compte - " AND E.entryBook = :entryBook"; + // concerne le journal + " AND E.financialTransaction.entryBook = :entryBook"; List<Entry> entries = context.find(query, "beginDate", beginDate, "endDate", endDate, "entryBook", entryBook); @@ -181,8 +181,8 @@ // entre les 2 dates " WHERE :beginDate <= E.financialTransaction.transactionDate" + " AND E.financialTransaction.transactionDate <= :endDate" + - // concerne le compte - " AND E.entryBook = :entryBook" + + // concerne le journal + " AND E.financialTransaction.entryBook = :entryBook" + " GROUP BY E.debit"; List<Object[]> result = context.find(query, "beginDate", beginDate,