Hibernate Version: 3.2
I'm having a strange problem with Hibernate and Derby. I'm getting HQL Syntax Exceptions even though I'm not using HQL.
It throws the exception:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: *
when I do
Form form = new Form();
form = (Form)session.createQuery("select * from USERTABLE where EMAIL = " + email).uniqueResult();
hibernate.cfg.xml
Code:
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="connection.url">jdbc:derby://localhost:1527/info</property>
<property name="connection.username">app</property>
<property name="connection.password">app</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">false</property>
<!-- Mapping files -->
<mapping resource="Form.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Form.hbm.xmlCode:
<hibernate-mapping>
<class name="myPackage.Form" table="USERTABLE">
<id name="userID" type="int">
<generator class="increment"/>
</id>
<property name="userName" type="string"/>
<property name="password" type="string"/>
<property name="email" type="string"/>
<property name="userState" type="string"/>
<property name="city" type="string"/>
</class>
</hibernate-mapping>
Code: