Glad to see it was an easy fix :) Nathan
----- Original Message ----- From: "romsrini" <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, May 21, 2007 3:06:52 PM (GMT-0800) America/Los_Angeles Subject: Re: [appfuse-user] How do I perform a join in a dao.hibernate finder? Doh, I feel stupid. A misplaced quotation mark. Its good to know I can do joins in my HQL. Thanks. melinate wrote: > > I'm not great on my HQL, but judging by the error message I think the > problem is the comma near the end: > > recipient.heardFlag = 0, callerId > ^ > > Since I am very familiar with SQL, I would expect that character to cause > a problem because it would make the statement invalid. I'm guessing you > meant for the statement to look like the following so "callerId" is being > used as a parameter in the statement. > > > public List<Message> getNewActualMessagesByCaller(long callerId) { > return getHibernateTemplate().find("select message from > com.lexy.model.Message message, com.lexy.model.MessageRecipient recipient > where message.id = recipient.message and recipient.caller=? and > recipient.heardFlag = 0", callerId); > } > > > Hope that helps, > Nathan > > ----- Original Message ----- > From: "romsrini" <[EMAIL PROTECTED]> > To: [email protected] > Sent: Monday, May 21, 2007 11:44:26 AM (GMT-0800) America/Los_Angeles > Subject: [appfuse-user] How do I perform a join in a dao.hibernate finder? > > > When I tried to test the following piece of code, > > public List<Message> getNewActualMessagesByCaller(long callerId) { > return getHibernateTemplate().find("select message from > com.lexy.model.Message message, com.lexy.model.MessageRecipient recipient > where message.id = recipient.message and recipient.caller=? and > recipient.heardFlag = 0, callerId"); > } > > in a ..DaoHibernate class, I got the following error: > "org.springframework.orm.hibernate3.HibernateQueryException: unexpected > token: , near line 1, column 182 .." > > Clearly there is a problem with the join in my HQL, but I know the > database > model is correct so it must be something in my syntax. Any suggestions? > > I was able to work around this problem by defining a collection in one my > model classes using annotations, but I'd prefer to able to do the join in > a > finder. > > Thanks, > Rom > > > -- > View this message in context: > http://www.nabble.com/How-do-I-perform-a-join-in-a-dao.hibernate-finder--tf3792097s2369.html#a10724556 > Sent from the AppFuse - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/How-do-I-perform-a-join-in-a-dao.hibernate-finder--tf3792097s2369.html#a10728092 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
