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: join at runtime problem
PostPosted: Tue Mar 02, 2010 12:05 pm 
Newbie

Joined: Tue Mar 02, 2010 11:25 am
Posts: 1
Hi all, i'm trying to write a CreateCriteria to manage my entities but i had some problems:

i have 6 tables to manage products and categories data with different languages:
http://hman.pastebin.com/KkpLtGfA

i created entities class in my asp.net application:
http://hman.pastebin.com/b9LhFUNt

i created also mapping files:
http://hman.pastebin.com/JbsXf5gV

query that i would like to write should:
get t_products_descriptions order by t_products_descriptions.T_PRODUCTS_NAME
where t_products_descriptions.t_languages.t_languages_name = 'English'
and t_products_categories.t_categories.t_categories_id = <specific cat>

my problem is that t_products_descriptions and t_products_categories have ref to t_products but there isn't a direct ref from t_products_descriptions to t_products_categories, the only class that is present both classes is t_products.

i tryed
// Prepare query conditions
ICriteria criteria = session.CreateCriteria(typeof(t_products_descriptions))
.AddOrder(new Order("T_PRODUCTS_NAME", true));

ICriteria langCriteria = criteria
.CreateCriteria("T_LANGUAGES")
.Add(Expression.Eq("T_LANGUAGES_NAME", Master.globalObject.DefaultLanguage));

ICriteria catCriteria = criteria
.CreateCriteria("T_PRODUCTS")
.SetFetchMode("t_products_categories", FetchMode.Join)
.Add(Expression.Eq("prodcats.T_CATEGORIES.T_CATEGORIES_ID",
myCat.T_CATEGORIES.T_CATEGORIES_ID));

but naturally i received:
could not resolve property: prodcats of: Arkdisplayweb.Entities.t_products


Could you help me ?


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.