Мне не удается создать таблицу в моей базе данных: «Неудачно: опция создания таблицы (целое число option_id не равно auto_increment, целое число департамента_департамента_идентификатора, первичный ключ (option_id))»
Я использую RedHat Jboss Developer Studio, MySQL и Apache 3.3, я не понял ошибку.
это объект, который имеет проблему для создания в виде таблицы в базе данных, хотя я пробовал с другими объектами, и у меня не было проблем.
package tn.esprit.student_placement_platform.entities;
import java.io.Serializable;
import javax.persistence.*;
/**
* Entity implementation class for Entity: Option
*
*/
@Entity
@Table(name="option")
public class Option implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="option_id")
private int option_id;
public Option() {
}
это моя консоль
13:09:58,300 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
13:09:58,589 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
13:09:58,668 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) starting
13:10:00,117 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 8) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
13:10:00,126 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 13) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=ExampleDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
13:10:00,127 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 13) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=MySQLDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
13:10:00,127 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 13) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=MySqlDSSemester2' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
13:10:00,127 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 13) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=MySqlDSStudentPP' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
13:10:00,193 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found student_placement_platform-ear.ear in deployment directory. To trigger deployment create a file called student_placement_platform-ear.ear.dodeploy
13:10:00,211 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
13:10:00,257 INFO [org.xnio] (MSC service thread 1-5) XNIO version 3.3.1.Final
13:10:00,266 INFO [org.xnio.nio] (MSC service thread 1-5) XNIO NIO Implementation Version 3.3.1.Final
13:10:00,380 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
13:10:00,380 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
13:10:00,380 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
13:10:00,428 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
13:10:00,428 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
13:10:00,399 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
13:10:00,399 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
13:10:00,513 INFO [org.jboss.as.naming] (MSC service thread 1-6) WFLYNAM0003: Starting Naming Service
13:10:00,529 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.2.9.Final starting
13:10:00,546 INFO [org.jboss.as.connector] (MSC service thread 1-8) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.4.Final)
13:10:00,546 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0003: Undertow 1.2.9.Final starting
13:10:00,513 INFO [org.jboss.as.mail.extension] (MSC service thread 1-7) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
13:10:00,513 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
13:10:00,546 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = h2
13:10:00,546 INFO [org.jboss.as.security] (MSC service thread 1-3) WFLYSEC0001: Current PicketBox version=4.9.2.Final
13:10:00,546 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
13:10:00,546 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0018: Started Driver service with driver-name = mysql
13:10:00,668 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path C:\wildfly-9.0.1.Final [Configur+®]\wildfly-9.0.1.Final/welcome-content
13:10:01,732 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
13:10:01,762 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: Host default-host starting
13:10:01,766 INFO [org.jboss.remoting] (MSC service thread 1-5) JBoss Remoting version 4.0.9.Final
13:10:01,833 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "student_placement_platform-ear.ear" (runtime-name: "student_placement_platform-ear.ear")
13:10:01,850 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
13:10:01,850 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) WFLYDS0013: Started FileSystemDeploymentService for directory C:\wildfly-9.0.1.Final [Configur+®]\wildfly-9.0.1.Final\standalone\deployments
13:10:01,846 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: Bound data source [java:jboss/datasources/MySQLDS]
13:10:01,854 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:/MySqlDSStudentPP]
13:10:01,846 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) WFLYJCA0001: Bound data source [java:/MySqlDSSemester2]
13:10:01,863 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP listener default listening on localhost/127.0.0.1:18080
13:10:02,061 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "student_placement_platform-ejb.jar")
13:10:02,061 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0207: Starting subdeployment (runtime-name: "student_placement_platform-web.war")
13:10:02,177 INFO [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final
13:10:02,844 INFO [org.jboss.as.jpa] (MSC service thread 1-3) WFLYJPA0002: Read persistence.xml for student_placement_platform-ejb
13:10:03,103 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 58) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'student_placement_platform-ear.ear/student_placement_platform-ejb.jar#student_placement_platform-ejb'
13:10:03,142 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 58) HHH000204: Processing PersistenceUnitInfo [
name: student_placement_platform-ejb
...]
13:10:03,383 INFO [org.hibernate.Version] (ServerService Thread Pool -- 58) HHH000412: Hibernate Core {4.3.10.Final}
13:10:03,383 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 58) HHH000206: hibernate.properties not found
13:10:03,387 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 58) HHH000021: Bytecode provider name : javassist
13:10:03,690 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 58) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'student_placement_platform-ear.ear/student_placement_platform-ejb.jar#student_placement_platform-ejb'
13:10:04,234 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 58) HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
13:10:04,685 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 58) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
13:10:04,833 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 58) HHH000397: Using ASTQueryTranslatorFactory
13:10:04,868 INFO [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 58) HV000001: Hibernate Validator 5.1.3.Final
13:10:05,365 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000228: Running hbm2ddl schema update
13:10:05,365 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000102: Fetching database metadata
13:10:05,372 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000396: Updating schema
13:10:05,409 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000261: Table found: student_placement_platform.admin
13:10:05,409 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000037: Columns: [admin_gender, admin_phonenumber, admin_username, admin_role, admin_id, admin_cin, admin_lastname, admin_name, admin_address, admin_birthdate, admin_password, admin_email]
13:10:05,409 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000108: Foreign keys: []
13:10:05,409 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000126: Indexes: [primary]
13:10:05,454 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000261: Table found: student_placement_platform.department
13:10:05,454 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000037: Columns: [department_id, department_name, site_site_id, headofdepartment_head_of_department_id]
13:10:05,454 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000108: Foreign keys: [fk_7tpjt9qrsuwrgwpi7gk2r2ev5, fk_i0rg5vsnw9610tb8w6hnch3nh]
13:10:05,454 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000126: Indexes: [fk_7tpjt9qrsuwrgwpi7gk2r2ev5, primary, fk_i0rg5vsnw9610tb8w6hnch3nh]
13:10:05,484 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000261: Table found: student_placement_platform.head_of_department
13:10:05,484 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000037: Columns: [head_of_department_name, head_of_department_username, head_of_department_cin, head_of_department_password, head_of_department_lastname, head_of_department_address, head_of_department_gender, head_of_department_id, head_of_department_role, head_of_department_birthdate, head_of_department_email, head_of_department_phonenumber]
13:10:05,484 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000108: Foreign keys: []
13:10:05,484 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000126: Indexes: [primary]
13:10:05,486 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: option
13:10:05,503 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000261: Table found: student_placement_platform.placement_director
13:10:05,503 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000037: Columns: [placement_director_lastname, placement_director_cin, placement_director_password, placement_director_id, placement_director_phonenumber, placement_directorname, placement_director_address, placement_director_birthdate, placement_director_email, placement_director_username, placement_director_role, placement_director_hiringdate]
13:10:05,505 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000108: Foreign keys: []
13:10:05,505 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000126: Indexes: [primary]
13:10:05,519 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000261: Table found: student_placement_platform.school
13:10:05,519 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000037: Columns: [school_email, admin_admin_id, school_id, school_address, school_phonenumber, school_name, subscription_subscription_id]
13:10:05,519 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000108: Foreign keys: [fk_mhxbm11ylj3qcaxg5xqbb0o96, fk_2ywkie89vyyvmhyc7iseqqjq7]
13:10:05,519 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000126: Indexes: [fk_mhxbm11ylj3qcaxg5xqbb0o96, fk_2ywkie89vyyvmhyc7iseqqjq7, primary]
13:10:05,533 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000261: Table found: student_placement_platform.site
13:10:05,533 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000037: Columns: [site_name, site_address, site_id, placementdirector_placement_director_id, school_school_id]
13:10:05,533 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000108: Foreign keys: [fk_2012bhpf8nikltxldidgju4g7, fk_3ekyu5v3yx6fdaxb1a456lgxv]
13:10:05,533 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000126: Indexes: [fk_2012bhpf8nikltxldidgju4g7, fk_3ekyu5v3yx6fdaxb1a456lgxv, primary]
13:10:05,549 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000261: Table found: student_placement_platform.subscription
13:10:05,550 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000037: Columns: [subscription_id, subscription_academic_year, subscription_payment_type, subscription_payment_amount, subscription_date]
13:10:05,550 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000108: Foreign keys: []
13:10:05,550 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] (ServerService Thread Pool -- 58) HHH000126: Indexes: [primary]
13:10:05,551 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: option
13:10:05,554 INFO [java.sql.DatabaseMetaData] (ServerService Thread Pool -- 58) HHH000262: Table not found: option
13:10:05,567 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000388: Unsuccessful: create table option (option_id integer not null auto_increment, primary key (option_id))
13:10:05,567 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) 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 'option (
option_id integer not null auto_increment,
primary key ' at line 1
13:10:05,567 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 58) HHH000232: Schema update complete
13:10:05,833 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 61) Initializing Mojarra 2.2.11-jbossorg-1 20150505-1501 for context '/student_placement_platform-web'
13:10:07,142 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 61) Running on PrimeFaces 5.3
13:10:07,171 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 61) WFLYUT0021: Registered web context: /student_placement_platform-web
13:10:07,266 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "student_placement_platform-ear.ear" (runtime-name : "student_placement_platform-ear.ear")
13:10:07,612 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:19990/management
13:10:07,612 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:19990
13:10:07,612 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started in 9709ms - Started 356 of 549 services (237 services are lazy, passive or on-demand)
Мой pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>tn.esprit</groupId>
<artifactId>student_placement_platform</artifactId>
<version>1.0</version>
</parent>
<artifactId>student_placement_platform-ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>tn.esprit</groupId>
<artifactId>student_placement_platform-web</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>tn.esprit</groupId>
<artifactId>student_placement_platform-ejb</artifactId>
<type>ejb</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>${version.ear.plugin}</version>
<configuration>
<version>7</version>
<fileNameMapping>no-version</fileNameMapping>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
<configuration>
<filename>${project.artifactId}.ear</filename>
<port>19990</port>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>