Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: hibernate3.jar
Mapping documents:
-------------file 1---
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jboss11</property>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.connection.password">11user</property>
<property name="hibernate.connection.username">jboss11user</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="com/web11/User.hbm.xml" />
</session-factory>
</hibernate-configuration>
----file1 end-------------
-----------file2----------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.web11.User" table="user" catalog="">
<id name="Userid" type="java.lang.String">
<column name="USERID" scale="32" precision="0" not-null="true" sql-type="varchar" />
<generator class="assigned" />
</id>
<property name="Password" type="java.lang.String">
<column name="password" scale="41" precision="0" not-null="false" sql-type="varchar" />
</property>
<property name="Clientid" type="java.lang.String">
<column name="CLIENTID" scale="128" precision="0" not-null="false" sql-type="varchar" />
</property>
</class>
</hibernate-mapping>
---------file2 end-----
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:MySQLServer41
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I downloaded/installed the file from
http://www.jboss.org/products/jbosside
JBossIDE-1.5M1-jre15-win32.zip 1.5 3.1M5a
"Windows Platform.---This zip contains a completely self-contained
distribution of JBossIDE 1.5 Milestone 1. Eclipse is bundled with this
release. This bundle requires a 1.5 JRE and includes our EJB3 Tools. "
Application server I am using jboss-3.2.6.zip.
OS is Windows 2000 server and j2sdk1.4.2_06.
It is working well so that I could create hibernate.cfg.xml.
I could also reverse engineering from my database(MySQLServer41) tables to generate
Java classes as well as all the .hbm.xml files. One of them is a small
table called User.hbm.xml.
Now I switch to Hibernate Console Perspective, and in HQL Editor, I
type: select u.Userid from User as u (Userid is one of the field of the
table User). Then I got
error---org.hibernate.exception.SQLGrammarException: could not execute
query.
I am actually following the web demo step by step. So I am not sure what I did wrong.
NIE