S
Snyke
Ok, I must admit that I'm pretty new to Hibernate but I can't get over
this error without help...
I have a class Privilege that is mapped to a MySQL Table. It has just 2
boolean values read and write, but I keep running into syntax errors
wether I want to create the database or insert a record:
03:21:58,339 ERROR SchemaExport:271 - Unsuccessful: create table privs
(id bigint not null auto_increment, read bit, write bit, primary key
(id))
03:21:58,340 ERROR SchemaExport:272 - You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'read bit, write bit, primary key
(id))' at line 1
03:21:58,341 INFO SchemaExport:202 - schema export complete
03:21:58,490 DEBUG SQL:346 - insert into privs (read, write) values (?,
?)
Hibernate: insert into privs (read, write) values (?, ?)
03:21:58,519 WARN JDBCExceptionReporter:71 - SQL Error: 1064,
SQLState: 42000
03:21:58,520 ERROR JDBCExceptionReporter:72 - You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'read, write) values ('0',
'0')' at line 1
The statements look ok to me, but MySQL doesn't seem to like them for
some obscure reason...
Anyway my configuration looks like this:
<hibernate-configuration>
<session-factory>
<property
name="connection.url">jdbc:mysql://localhost/test</property>
<property name="connection.username">root</property>
<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property
name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property
name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
[...]
</session-factory>
</hibernate-configuration>
And my mapping file like this:
<hibernate-mapping>
<class name="net.snyke.tmm.Privilege" table="privs">
<id name="id" column="id">
<generator class="native"/>
</id>
<property name="read"/>
<property name="write"/>
</class>
</hibernate-mapping>
Basically hibernate should create the tables and then insert one entry,
but both queries fail...
Any idea?
Thanks for your time,
Christian 'Snyke' Decker
http://www.Snyke.net
this error without help...
I have a class Privilege that is mapped to a MySQL Table. It has just 2
boolean values read and write, but I keep running into syntax errors
wether I want to create the database or insert a record:
03:21:58,339 ERROR SchemaExport:271 - Unsuccessful: create table privs
(id bigint not null auto_increment, read bit, write bit, primary key
(id))
03:21:58,340 ERROR SchemaExport:272 - You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'read bit, write bit, primary key
(id))' at line 1
03:21:58,341 INFO SchemaExport:202 - schema export complete
03:21:58,490 DEBUG SQL:346 - insert into privs (read, write) values (?,
?)
Hibernate: insert into privs (read, write) values (?, ?)
03:21:58,519 WARN JDBCExceptionReporter:71 - SQL Error: 1064,
SQLState: 42000
03:21:58,520 ERROR JDBCExceptionReporter:72 - You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'read, write) values ('0',
'0')' at line 1
The statements look ok to me, but MySQL doesn't seem to like them for
some obscure reason...
Anyway my configuration looks like this:
<hibernate-configuration>
<session-factory>
<property
name="connection.url">jdbc:mysql://localhost/test</property>
<property name="connection.username">root</property>
<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property
name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property
name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
[...]
</session-factory>
</hibernate-configuration>
And my mapping file like this:
<hibernate-mapping>
<class name="net.snyke.tmm.Privilege" table="privs">
<id name="id" column="id">
<generator class="native"/>
</id>
<property name="read"/>
<property name="write"/>
</class>
</hibernate-mapping>
Basically hibernate should create the tables and then insert one entry,
but both queries fail...
Any idea?
Thanks for your time,
Christian 'Snyke' Decker
http://www.Snyke.net