criteria

Grails: use list in Controller and View

限于喜欢 提交于 2019-12-12 02:58:38
问题 class Candidate { String username; static HasMany=[applications:Application] } class Vote { String name; Date firstdate; Date enddate ; static HAsMany=[applications:Application] } class Application { Date datedemand; Candidate candidate; Vote vote; static belongsTo = [candidate:Candidate,vote:Vote] } I want to display the list of votes and if I click on a vote, it displays the list of candidates for this vote. I started ​​the following attempt, and I remain blocked : def candidatsGrpByVte(){

flowable 集成mongodb

萝らか妹 提交于 2019-12-12 01:59:58
学无止境,活到老学到老,每天都问自己进步了吗? 1.背景 由于公司每天有至少1500个表单发起,处理待办任务至少7000个,累计历史任务数据已经达到200多w条,时间一长,通过数据库查询已办的任何和我发起的流程巨慢 所以我们考虑到这些数据能不能放入ES或者是mongodb中 流程中心1.0版本集成的是ES,速度确实非常快,提升查询性能近万倍,但是由于ES是一个全文检索的系统,对我们这些业务数据来说,不是很适合,比方说 我们的表单数据,他直接给分词了,不符合业务的要求。 流程中心2.0版本我们就改成mongodb,速度一样达到es的查询效果,解决了以前分词的问题,而且数据结构化查询也非常方便。 2.集成mongodb策略 集成mongodb的策略有两种 2.1.利用flowable提供的mongodb的插件来集成,具体可以参考他们提供的demo 2.2通过流程实例id和任务id查询表数据,做加工处理,然后在通过消息队列的方式同步到mongodb中 第一种方式就相当于把历史表的数据全部搬到mongodb中,在关系型数据库中不存放任何历史数据,正是由于中原因,我担心历史数据的丢失,所以我采用的是 第二种策略,关系数据库中有一份数据,在mongodb中我也有一份加工后的数据,以保证万无一失。 3.具体实现 3.1 同步数据 @Component @RabbitListener(queues

How do I query Hibernate for object where property may be null or specific value?

冷暖自知 提交于 2019-12-12 01:19:49
问题 I have the following objects I'm working with: RawRead RawRead.Checkpoint Checkpoint.EndCustomer Guard Where Checkpoint and Guard are properties of RawRead, EndCustomer is a property of Checkpoint. All are objects. My current Hibernate gubbins: Criteria crit = sess.createCriteria(RawRead.class); crit.add( Restrictions.or( Restrictions.eq("checkpoint", null), Restrictions.in("checkpoint.parentEndCustomer",collectionOfEndCustomers) ) ); So Checkpoint can be null, but if it is there I only want

Hibernate criteria implementation for this entity model (subquery, self-join)

穿精又带淫゛_ 提交于 2019-12-11 21:08:12
问题 Given the following entity one-to-many model: One Repository can be linked to many AuditRecords. Many AuditRecords can all link to the same Repository @Entity class AuditRecordEntity { private AuditRepositoryEntity auditRepository; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = AUDIT_REPOSITORY_DB_COLUMN_NAME, nullable = false, updatable = false) public AuditRepositoryEntity getAuditRepository() { return auditRepository; } ... } @Entity class AuditRepositoryEntity { private List

Nested Query in Hibernate using Criterion

删除回忆录丶 提交于 2019-12-11 21:05:29
问题 I have a following query where I have to select rows from temporary table created by subquery. select x, y, x from (select x, y, z from some_table where x between x1 and x2) where y like 'y1' order by z by desc I have to use Criteria for fetching result from database I have gone through several examples and documentation for handling subqueries using criteria and detached criteria. I have used Detached query but it is not serving the purpose or I am missing something. I have used following

Hibernate Criteria.ALIAS_TO_ENTITY_MAP to ArrayList Student missing

血红的双手。 提交于 2019-12-11 20:42:12
问题 I have one to many relationship I need to fetch eager the associate table as well filters the 2 tables using criteria. Here is my code.. public ArrayList<Student>getListOfStudents() { Session session = getHibernateTemplate().getSessionFactory().openSession(); Criteria like = session.createCriteria(Student.class) .setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); prepareForSelect(like);//some filtering Criteria innerCriteria = like.createCriteria("phone","p",JoinType.LEFT_OUTER_JOIN);

Export MS Access Report to PDF based on condition

自古美人都是妖i 提交于 2019-12-11 19:30:51
问题 Is there any way to export a report in MS Access to PDF based on a certain criteria/field on the report? I have created a productivity report in MS Access. Instead of exporting 50 pages into 1 PDF, is there a way to export based on the manager's name? The field for the managers name is included on the actual report. 回答1: You can take this idea and play with it. Insert this into a Module Option Explicit Dim g_ManagerReportFilterEnabled As Boolean Dim g_ManagerReportFilter As String Public

Grails's yesterday in criteria

こ雲淡風輕ζ 提交于 2019-12-11 17:14:07
问题 I'm building a criteria to get all yesterday's created records for a certain domain class. Something like def c = A.createCriteria().list { eq(<some operation on dateCreated>, <some operation on 'now'>) } Thanks in advance 回答1: How about Date today = new Date().clearTime() Date yesterday = today - 1 def c = A.createCriteria().list { ge(yesterday) lt(today) } 回答2: See example criteria here: http://www.grails.org/doc/1.3.7/ref/Domain%20Classes/withCriteria.html def now = new Date() between(

How can I retrieve a collection property using criteria Api

﹥>﹥吖頭↗ 提交于 2019-12-11 16:34:43
问题 I want to retrieve a collection property using criteria public class A { private Collection<B> property // getters and setters } public class B { private int status // getters and setters } My criteria code is as follows: Criteria cr = getSession().createCriteria(A.class) cr.createAlias("property", "prop") cr.add(Restrictions.eq("prop.status", status)); cr.setProjection(Projections.property("prop")); cr.list(); It's obvious this code doesn't work I wanted to simply demonstrate my intentions.

Conversion of below criteria into HQL

无人久伴 提交于 2019-12-11 16:24:35
问题 I have the following criteria please advise how can I convert the below criteria into HQL , as I want to use HQL public List<tttBook> findtooks() { List<tttBook> tooks =null; Criteria criteria = session.createCriteria(tttBook.class); ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("Id")); proList.add(Projections.property("longName")); tooks = criteria.list(); return tooks; } also please let me know in this above criteria what is wrong since right now it