Search Results

Search found 5 results on 1 pages for 'gilean'.

Page 1/1 | 1 

  • Hibernate Criteria: Perform JOIN in Subquery/DetachedCriteria

    - by Gilean
    I'm running into an issue with adding JOIN's to a subquery using DetachedCriteria. The code looks roughly like this: Criteria criteria = createCacheableCriteria(ProductLine.class, "productLine"); criteria.add(Expression.eq("productLine.active", "Y")); DetachedCriteria subCriteria = DetachedCriteria.forClass(Models.class, "model"); subCriteria.setProjection(Projections.rowCount()); subCriteria.createAlias("model.language", "modelLang"); criteria.add(Expression.eq("modelLang.language_code", "EN")); subCriteria.add(Restrictions.eqProperty("model.productLine.id","productLine.id")); criteria.add(Subqueries.lt(0, subCriteria)); But the logged SQL does not contain the JOIN in the subquery, but does include the alias which is throwing an error SELECT * FROM PRODUCT_LINES this_ WHERE this_.ACTIVE=? AND ? < (SELECT COUNT(*) AS y0_ FROM MODELS this0__ WHERE modelLang3_.LANGUAGE ='EN' AND this0__.PRODUCT_LINE_ID =this_.ID ) How can I add the joins to the DetachedCriteria? Hibernate version: 3.2.6.ga Hibernate core: 3.3.2.GA Hibernate annotations: 3.4.0.GA Hibernate commons-annotations: 3.3.0.ga Hibernate entitymanager: 3.4.0.GA Hibernate validator: 3.1.0.GA

    Read the article

  • Hibernate Criteria: Add restrictions to Criteria and DetachedCriteria

    - by Gilean
    Currently our queries add a variety of Restrictions to ensure the results are considered active or live. These Restrictions are used in several places/queries so a method was setup similar to public Criteria addStandardCriteria(Criteria criteria, ...) { // Add restrictions, create aliases based on parameters // and other non-trivial logic criteria.add(...); return criteria; } This has worked fine so far, but now this standard criteria needs to be added to a subquery using DetachedCriteria. Is there a way to modify this method to accept Criteria or DetachedCriteria or a Better way to add restrictions?

    Read the article

  • Wicket: Relative to absolute URL or get base URL

    - by Gilean
    If I have a relative path to a static asset (flash/blah.swf), what is the best way to convert this to an absolute URL (http://localhost/app/flash/blah.swf)? Or what is the best way to get the base URL of the Wicket application? I've tried using RequestUtils.toAbsolutePath but it doesn't seem to work reliably and is frequently throwing exceptions.

    Read the article

  • Hibernate Criteria: Return different entity type than rooted entity?

    - by Gilean
    I have entities similar to: ProductLine: id, name ProductLineContents: content_id, product_line_id Content: id, text, updated_time What I'd like to do is: for each product line, get the latest content (so if theres two content entries associated to one product line, the latest updated_time is rturned, and if one content item is associated to two product lines, it is returned twice). Something similar to: select content.* from productline inner join productlinecontents inner join content; However I can't seem to figure out how to have Hibernate Criteria return a different entity than the original one it was created with. So if I wanted to start the criteria at the product line with createCriteria(ProductLine.class) along with the proper joins, then it only returns ProductLine objects, but I need Content objects. What's the best way to accomplish this? The actual data model is much more complex and can't be modified

    Read the article

1