-->
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: createAlias for one to many relation
PostPosted: Wed Jul 21, 2010 1:51 pm 
Newbie

Joined: Wed Jul 21, 2010 1:36 pm
Posts: 1
Hi i am new to hibernate

I have three tables.
Table1
Project
ID


POJO
Project
Set<Milestone>
id(int)


Table2

MilestoneType
code

POJO
MilestoneType
set<Milestone>
code(int)

Table 3
Milestone
ID(from Project)
code(from MilestoneType)
desc

POJO
Milestone
object of Project
object of MilestoneType
description(String)

Table1 has one-to-many relation with Table3
Table2 also has one -to-many relation with Table3

i need to write a criteria from Project to check the desc of Milestone table.
I tried createAlias("Milestone","Milestone").createAlias("Milestone.MilestoneType","MilestoneAlias");

then i added the restriction
criteria.add(Restrictions.eq("MilestoneAlias.desc","description"));

but it showed me SQL grammar exception saying "MilestoneAlias12_.desc" invalid identifier

can anyone resolve this..


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.