-->
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: Problem with accessing association using Criteria Query
PostPosted: Tue Jul 07, 2009 2:00 pm 
Newbie

Joined: Tue Jul 07, 2009 1:48 pm
Posts: 3
Hi,

I have a one-to-many association between Class A and Class B. Below is how a list of B has been defined in Class A.

@OneToMany(fetch = FetchType.LAZY)
@JoinColumn(name = "ACT_CODE")
private List<B> actions = new ArrayList<B>();

I have a criteria query created as follows :

criteria = session.createCriteria(A.getClass());

How can I access an attribute of class B named "testAttribute"? I tried using Fetchtype.JOIN, createCriteria() and createAlias(), but none of them gives me results. I get the following exception :

org.hibernate.QueryException: could not resolve property: testAttribute of: B

Can anyone please help me out?


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.