-->
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.  [ 1 post ] 
Author Message
 Post subject: QBE QueryException - _com property
PostPosted: Wed Nov 02, 2011 2:05 am 
Newbie

Joined: Wed Nov 02, 2011 1:50 am
Posts: 1
Hi there,

I've recently started playing with the query by example component of the Criteria API.

My scenarios is as follows:

I have a class A, which as one of its properties has a set of instances of class B (Set<B> listOfBs).

I was hoping to set a criteria query on an example instance of B, for example all B's with a property value of "somevalue" and then find all A's that have such a B in their set:

Code:

        Criteria aCrit = session.createCriteria(A.class);
       
        A aExampleInstance = new A();
        Example aExampleCriteria = Example.create(aExampleInstance );

        Criteria bCrit = atCrit.createCriteria("listOfBs");
        B bExampleInstance = new B();
        bExampleInstance .setProperty("somevalue");
        bCrit.add(Example.create(bExampleInstance ));

        List<A> results = aCrit.add(aExampleCriteria).list();



I am using XML mapping, and A is mapping B as follows (A.hbm.xml):

Code:
   
    <set name="listOfBs" table="B" inverse="false" cascade="all" lazy="true">
       <key column="A_ID" not-null="true"/>
       <one-to-many class="B"/>
    </set>



I realize that this might not be the right approach - any better suggestions are welcome. The trouble is that I get an exception:

Quote:
org.hibernate.QueryException: could not resolve property: _com of: B


There is no such property name declared in any of my classes - so I am wondering if this may be a hibernate issue? Is there a workaround, or perhaps a resolution in a newer version? How can I proceed? I am using Hibernate 3.6.6.

Thanks


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

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.