-->
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.  [ 4 posts ] 
Author Message
 Post subject: outer or full join must be followed by path expression
PostPosted: Fri Jul 15, 2005 3:03 pm 
Newbie

Joined: Fri Jul 15, 2005 2:48 pm
Posts: 2
Can someone comment on this pls? I am getting the above exception, and here is my query

pack = abc.def.ghi
String sb = ("from Course as course join "+pack+"Group as gr join "+pack+"GroupEvent as groupEvent where groupEvent.eventReleased = 1 ");

Query query = session.createQuery(sb.toString());
List list = query.list();

and here are my hibernate files,

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="abc.def.ghi">

<class name="Course" table="courses">
<id name="courseId" column="CourseID" type="int">
<generator class="increment"/>
</id>

<property name="semesterId" column="SemesterID" />
<property name="deliveryModelId" column="DeliveryModelID" />
<property name="courseName" column="Name" />
<property name="description" column="Description" />
<set name="events" cascade="all" inverse="true" >
<key column="CourseID" />
<one-to-many class="CourseEvent" />
</set>
<list name="groups" cascade="all" inverse="true" >
<key column="CourseID" />
<index column="groupId"/>
<one-to-many class="Group" />
</list>

</class>


</hibernate-mapping>


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="abc.def.ghi">

<class name="Group" table="groups" >
<id name="groupId" column="GroupID" type="int" >
<generator class="increment"/>
</id>
<property name="groupName" column="GroupName" />
<property name="groupCode" column="GroupCode" />

<set name="events" cascade="all" inverse="true" >
<key column="GroupID" />
<one-to-many class="GroupEvent" />
</set>

<many-to-one name="course" column="CourseID" class="Course" />


</class>


</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping package="abc.def.ghi">

<class name="GroupEvent" table="group_events" >
<id name="eventId" column="GroupEventID" type="int" >
<generator class="increment"/>
</id>

<property name="name" column="name"/>
<property name="description" column="description"/>
<property name="noOfSessions" column="noofsessions"/>
<property name="maxChoices" column="maxchoices"/>
<property name="endDate" column="enddate"/>
<property name="eventReleased" column="EventReleased" />


<list name="sessions" cascade="all" inverse="true" >
<key column="GroupEventID" />
<index column="Ind"/>
<one-to-many class="GroupEventSession" />
</list>



<many-to-one name="group" column="GroupID" class="Group" />
</class>


</hibernate-mapping>


Can someone help pls? Oh yeah other queries like following work fine


String sb = "select groupEvent from GroupEvent groupEvent where groupEvent.group.course.courseId = 2 order by groupEvent.eventId";


Top
 Profile  
 
 Post subject: Re: outer or full join must be followed by path expression
PostPosted: Fri Jul 15, 2005 3:13 pm 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
canadian wrote:
Can someone comment on this pls? I am getting the above exception, and here is my query

Code:
pack = abc.def.ghi
String sb = ("from Course as course join "+pack+"Group as gr join "+pack+"GroupEvent as groupEvent where groupEvent.eventReleased = 1 ");

Query query = session.createQuery(sb.toString());
List list = query.list();



It would help a lot if you'd use the code tags and post valid Java. However, from what you posted it looks like the value of "pack" is wrong. You should have a period after it, or included when you build your "sb" String.

You are building this:
abc.def.ghiGroup

Don't you want this instead?
abc.def.ghi.Group


Top
 Profile  
 
 Post subject: Re: outer or full join must be followed by path expression
PostPosted: Fri Jul 15, 2005 3:42 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
jdl wrote:
canadian wrote:
Can someone comment on this pls? I am getting the above exception, and here is my query

Code:
pack = abc.def.ghi
String sb = ("from Course as course join "+pack+"Group as gr join "+pack+"GroupEvent as groupEvent where groupEvent.eventReleased = 1 ");

Query query = session.createQuery(sb.toString());
List list = query.list();



It would help a lot if you'd use the code tags and post valid Java. However, from what you posted it looks like the value of "pack" is wrong. You should have a period after it, or included when you build your "sb" String.

You are building this:
abc.def.ghiGroup

Don't you want this instead?
abc.def.ghi.Group


I also think you're join is incorrect. in HQL you join on the field so it should be something like -

Code:
select course from Course as course join course.groups as group join group.events as groupEvent where groupEvent.eventReleased = 1


Top
 Profile  
 
 Post subject: Re: outer or full join must be followed by path expression
PostPosted: Mon Jul 18, 2005 1:28 pm 
Newbie

Joined: Fri Jul 15, 2005 2:48 pm
Posts: 2
pksiv wrote:
jdl wrote:
canadian wrote:
Can someone comment on this pls? I am getting the above exception, and here is my query

Code:
pack = abc.def.ghi
String sb = ("from Course as course join "+pack+"Group as gr join "+pack+"GroupEvent as groupEvent where groupEvent.eventReleased = 1 ");

Query query = session.createQuery(sb.toString());
List list = query.list();



It would help a lot if you'd use the code tags and post valid Java. However, from what you posted it looks like the value of "pack" is wrong. You should have a period after it, or included when you build your "sb" String.

You are building this:
abc.def.ghiGroup

Don't you want this instead?
abc.def.ghi.Group


I also think you're join is incorrect. in HQL you join on the field so it should be something like -

Code:
select course from Course as course join course.groups as group join group.events as groupEvent where groupEvent.eventReleased = 1


THank you guys it worked. And yes I am sorry for invalid java. I forgot to add a period in the package. As they say "if you miss a period you are screwed" :D.

Thanks again


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.