Hi Rob, Thank you for the reply..I had corrected the correction you suggested query syntax, but still I m facing another problem while fetching the values from db I was not sure about how to refere the third table employeeproject fields in to the query where I have class fields of Employee and Project in this EmployeeProject class but how can I refer the respective id fields(employeeId and projectId) in to the query. I was not sure about it kindly guide me.
Regards Trish. Following error found: 2008-04-08 16:54:22.215::WARN: Nested in javax.servlet.ServletException: javax.servlet.ServletException: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode \-[IDENT] IdentNode: 'employeeId' {originalText=employeeId} : javax.servlet.ServletException: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode \-[IDENT] IdentNode: 'employeeId' {originalText=employeeId} at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at org.appfuse.webapp.filter.StaticFilter.doFilterInternal(StaticFilter.java:106) Rob Hills wrote: > > Hi Trish, > > Trish wrote: >> Hi >> >> Im new to appfuse and trying to implement manay to many relation for >> Employee Project tables, the created model classes as follows >> > At a quick glance, your entities look OK to me. >> public List<Employee> getByProject(Long projectId, Long periodId) { >> return getHibernateTemplate().find("from Employee where employeeId in " >> + >> "(select employeeId from EmployeesProject " + >> "where projectId=?"+ projectId+")"); >> } >> > However, you're mixing styles with your search expression and that won't > help you at all. You're trying to use a parameter placeholder (the ? in > "where projectId=?") but then you're appending the value to your query > string instead of setting the parameter value. The last line of your > search expression should either be: > > "where projectId=" + projectId + ")"); > > or > > "where projectId=?)", projectId, Hibernate.LONG); > > I believe the second approach is considered safer as the persistence > mechanism looks after security problems like "SQL Injection" for you. > It is also likely to perform better. > > To learn more about Hibernate, you're better off examining Hibernate > documentation, starting somewhere like here: > http://www.hibernate.org/5.html > > I don't think that the AppFuse project will have a lot of information > about using Hibernate as that task really belongs to the Hibernate > project. > > HTH, > > Rob Hills > Waikiki, Western Australia > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Help-needed-for-Many-to-Many-relation-tp16547740s2369p16557413.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]