title: How to use inner join query in hql?
body: <p>i have two tables
  <strong>table 1</strong>
  user(id*(pk)<em>,name,email,pwd)
  <strong>table 2</strong>
  tweet(tweet_id,message,user_id</em>(fk)*)</p>
  
  <p>user_id is foreign key to user table id. I want to join these two tables using inner join in hql.</p>
  
  <p>I am getting this error.</p>
  
  <p>Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1, column 74 [select user_name, message from com.csc.project.user e inner join tweet p on p.user_id=e.id where e.user_name=:name]
      at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
      at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
      at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
      at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258)
      at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
      at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
      at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
      at org.hibernate.engine.query.HQLQueryPlan.(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 com.csc.project.tweetManager.viewtweet(tweetManager.java:80)
      at com.csc.project.tweetManager.main(tweetManager.java:103)</p>
  
  <p><strong><em>this is my hibernate.cfg</em></strong></p>
  
  <pre><code>&lt;!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
  
  
  &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
  &lt;property name="connection.url"&gt;jdbc:mysql://localhost/twitter&lt;/property&gt;
  &lt;property name="connection.user"&gt;root&lt;/property&gt;
  &lt;property name="connection.password"&gt;root&lt;/property&gt;
  
  
  
  &lt;property name="show_sql"&gt;true &lt;/property&gt;
  &lt;property name="dialet"&gt;org.hibernate.dialect.MySQLDialect &lt;/property&gt;
  &lt;property name="hbm2ddl.auto"&gt;update &lt;/property&gt;
  
  &lt;mapping resource="registration.hbm.xml" /&gt;
  &lt;mapping resource="tweet.hbm.xml"/&gt;
  
  
  &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p><strong><em>reigistration.hbm</em></strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC 
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "hibernate-mapping-3.0.dtd"&gt;
  &lt;hibernate-mapping&gt;
     &lt;class name="com.csc.project.user" table="t1"&gt;
        &lt;meta attribute="class-description"&gt;
           This class contains the employee detail. 
        &lt;/meta&gt;
        &lt;id name="id" type="int" column="id"&gt;
           &lt;generator class="increment"/&gt;
        &lt;/id&gt;
  
  
  
        &lt;property name="user_name" column="user_name" type="string"/&gt;
        &lt;property name="user_email" column="user_email" type="string"/&gt;
        &lt;property name="password" column="password" type="string"/&gt;
        &lt;property name="created" type="timestamp" column="created"/&gt;
     &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p><strong><em>tweet.hbm</em></strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC 
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "hibernate-mapping-3.0.dtd"&gt;
  &lt;hibernate-mapping&gt;
     &lt;class name="com.csc.project.tweet" table="t2"&gt;
        &lt;meta attribute="class-description"&gt;
           This class contains the employee detail. 
        &lt;/meta&gt;
        &lt;id name="tweet_id" type="int" column="tweet_id"&gt;
           &lt;generator class="increment"/&gt;
        &lt;/id&gt;
  
  
       &lt;property name="user_id" column="user_id" type="int"/&gt;
        &lt;property name="message" column="message" type="string"/&gt;
       &lt;!--  &lt;property name="user_email" column="user_email" type="string"/&gt;
        &lt;property name="password" column="password" type="string"/&gt; --&gt;
        &lt;property name="created" type="timestamp" column="created"/&gt;
     &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>