I got Query for fetch two tables data combined
I am trying to use it in Java program which work with Hibernate3. When Ever i try to fetch data, I got exception. My complete code is in Question in Coderanch, 1st reply have complete java, xml files..
Here I my query which I used in java program
String selectQuery = "select student.roll_no, student.name, exam_dates.subject, exam_dates.date "
+ "from student student "
+ "JOIN exam_dates exam_dates on exam_dates.roll_no = student.roll_no";
and another for trial
String selectQuery = "select student.roll_no, student.name, exam_dates.subject, exam_dates.date "
+ "from student student "
+ "INNER JOIN exam_dates exam_dates on exam_dates.roll_no = student.roll_no";
By using it,I get exception as follows:-
14:19:07,752 INFO MemoryContextFactory:34 - Creating EJB3Unit initial JNDI context
org.hibernate.QueryException: outer or full join must be followed by path expression [select student.roll_no, student.name, exam_dates.subject, exam_dates.date from student student INNER JOIN exam_dates exam_dates on exam_dates.roll_no = student.roll_no]
at org.hibernate.hql.classic.FromParser.token(FromParser.java:170)
at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:86)
at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:108)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:216)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:185)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at test_db.get_table_by_join(test_db.java:99)
at test_db$1.run(test_db.java:40)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Can Anyone help me?
exam_datestable anexam_datesalias.