-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: HHH90000016 with collection property
PostPosted: Thu Jan 21, 2016 3:53 pm 
Newbie

Joined: Sat Apr 02, 2011 1:06 pm
Posts: 11
Hello,

I have the following entity mapping:

Code:
public MyEntity {

    @ElementCollection(fetch = FetchType.LAZY)
    @CollectionTable(name = "my_entity_name_lv", joinColumns = @JoinColumn(name = "my_entity_pk"), indexes = { @Index(columnList = "my_entity_pk") })
    @MapKeyColumn(name = "locale")
   private Map<Locale, LocalizedValue> name;
}


where LocalizedValue is the following @Embeddable:
Code:
@Embeddable
public class LocalizedValue implements Localized {

    /**
     * Default serial version uid.
     */
    private static final long serialVersionUID = 1L;

    @Column(name = "value")
    private String value;


Now I want to select all of MyEntity which have the name "My name", so I do the following query:
Code:
select p from my_entity as p join p.name as n where :name in (VALUE(n))


and I pass the name as parameter to the query. The problem is I keep getting these warnings from Hibernate:
Code:
HHH90000016: Found use of deprecated 'collection property' syntax in HQL/JPQL query ...


How can I transform the query to get rid of these warnings?


Top
 Profile  
 
 Post subject: Re: HHH90000016 with collection property
PostPosted: Wed Feb 24, 2016 8:24 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You need to write the query as:

Code:
select p
from my_entity p
where :name in elements(p.name)


Top
 Profile  
 
 Post subject: Re: HHH90000016 with collection property
PostPosted: Mon May 23, 2016 10:50 pm 
@mihalcea_vlad, I'm facing the same issue, but apparently the query is fine:

Original query using *Mysema querydsl*:
Code:
JPAQuery query = new JPAQuery(this.getEntityManager());
QCampaignEntity qCampaign = QCampaignEntity.campaignEntity;
QCampaignVersion qCampaignVersion = QCampaignVersion.campaignVersion;

BooleanBuilder builder = new BooleanBuilder();
builder.and(qCampaignVersion.introducers.contains(introducer));
builder.and(qCampaignVersion.brandings.contains(branding));

List<CampaignEntity> res = query
      .from(qCampaign)
      .innerJoin(qCampaign.activeVersion, qCampaignVersion)
      .where(builder)
      .list(qCampaign);


Generated JPA:
Code:
select campaignEntity
from CampaignEntity campaignEntity
inner join campaignEntity.activeVersion as campaignVersion
where ?1 in elements(campaignVersion.introducers) and
         ?1 in elements(campaignVersion.brandings)


Warning regards to introducers and brandings filter.
Fyi, I'm using Hibernate 5.0.7, Mysema (querydsl-jpa) 3.7.2, and Wildfly 8.2.
After upgrading to the said Hibernate version, many queries started throwing this warning and it's just a big effort to refactor all of them (when possible) to use joins.


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.