MySQL Database creation table Error solution

Source: Internet
Author: User

entity class PackageCom.tao.pojo; Public classStudent {
PrivateString ID; PrivateString name; PrivateString Pass; PublicStudent () {Super(); } PublicStudent (string name, String pass) {Super(); This. Name =name; This. pass =Pass; } PublicStudent (string ID, string name, String pass) {Super(); This. ID =ID; This. Name =name; This. pass =Pass; } PublicString getId () {returnID; } Public voidsetId (String id) { This. ID =ID; } PublicString GetName () {returnname; } Public voidsetName (String name) { This. Name =name; } PublicString Getpass () {returnPass; } Public voidSetPass (String pass) { This. pass =Pass; } @Override PublicString toString () {return"Student [id=" + ID + ", name=" + name + ", pass=" + Pass + "]"; }} Map File<?xml version= "1.0"? ><! DOCTYPE hibernate-mapping Public "-//hibernate/hibernate mapping DTD 3.0//en" "http://hibernate.sourceforge.net/ Hibernate-mapping-3.0.dtd "><!--Generated 2018-3-1 14:18:27 by Hibernate Tools 3.5.0.Final-->< Hibernate-mapping> <className= "Com.tao.pojo.Student" table= "Student" > <id name= "id" type= "java.lang.String" > <column Name= "ID"/> <generatorclass= "uuid"/> </id> <property name= "name" type= "java.lang.String" > <column name= "N AME "/> </property> <property name=" pass "type=" java.lang.String "> <column name = "PASS"/> </property> </class>configuration file<?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE hibernate-Configuration Public"-//hibernate/hibernate Configuration DTD 3.0//en" "Http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd" & gt;//localhost:3306/test0228_002</property><property name= "Hibernate.connection.username" >root</property> <property name= "Hibernate.dialect" & gt;org.hibernate.dialect.mysqldialect</property> <property name= "Show_sql" >true</property> <property name= "Format_sql" >true</property> <property name= "Hbm2ddl.auto" >update</property> <mapping resource= " Com/tao/pojo/student.hbm.xml "/> </session-factory>Test Packagecom.tao.test;Importorg.hibernate.Session;Importorg.hibernate.SessionFactory;Importorg.hibernate.cfg.Configuration;ImportOrg.hibernate.dialect.MySQL5Dialect; Public classTestmain {//Create a table with the Hibernate framework Public Static voidMain (string[] args) {Configuration Configure=NewConfiguration (). Configure ("Hibernate.cfg.xml"); Sessionfactory Factory=configure.buildsessionfactory (); Session Session=factory.opensession (); Session.begintransaction (); Session.gettransaction (). commit (); Session.close (); Factory.close (); }} Use the program to generate the table, if the report has this error caused By:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:You has an error in your SQL Syntax Check the manual, corresponds to your MySQL server version forThe right syntax to use near ' Type=myisam ' at line 6The solution changes the database dialect to<property name= "Hibernate.dialect" >org.hibernate.dialect.MySQL5Dialect</property>

MySQL Database creation table Error solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.