我无法理解以下JPQL
查询可能出现的问题:
StringBuilder sb = new StringBuilder("FROM FaPrimaryDocument AS t WHERE (t.debitAccount.id = :id or t.creditAccount.id = :id) " +
"AND t.debitAccount IS NOT NULL AND t.creditAccount IS NOT NULL ");
Query q = em.createQuery(sb.toString(), FaPrimaryDocument.class)
.setParameter("id", id);
List<FaPrimaryDocument> transactions = q.getResultList();
以上查询返回debitAccount/creditAccount = null
行。如何更改它以便不返回debitAccount/creditAccount = null
答案 0 :(得分:1)
我尝试了一些不同的方法。在这里它是如何运作的:
<div class="col-sm-4">
<?php if ( $the_query->have_posts() ): ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2 class="special-project-title"><?php the_title()?></h2> <br/>
<div class="post-meta special-project-meta"><?php mida_post_meta()?></div><br/>
<a class="more-link spaciel-project-more" href="<?php echo the_permalink() ?>"><?php echo __('Read More', 'mida')?></a><br/>
<?php endwhile; endif;?>
<?php wp_reset_query(); ?>
</div>