无法构建EntityManagerFactory Spring和Hibernate3.6.0

时间:2017-06-16 07:49:25

标签: java spring hibernate maven spring-mvc

我正在使用spring和hibernate开发一个web应用程序,在完成我的bean的映射之后,我运行了一个JUnit测试来检查映射是否正确并且我收到了以下错误:

> java.lang.AssertionError: Error creating bean with name
> 'entityManagerFactory' defined in class path resource
> [applicationContext.xml]: Invocation of init method failed; nested
> exception is javax.persistence.PersistenceException: [PersistenceUnit:
> UP_EBOUTIQUE] Unable to build EntityManagerFactory    at
> org.junit.Assert.fail(Assert.java:91)     at
> org.junit.Assert.assertTrue(Assert.java:43)   at
> com.msecmaroc.msec.testJPA.test1(testJPA.java:17)     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)     at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>   at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>   at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>   at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>   at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>   at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)  at
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)   at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)     at
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)   at
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)  at
> org.junit.runners.ParentRunner.run(ParentRunner.java:236)     at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
>   at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>   at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
>   at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>   at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

控制台日志:!!

> INFO :
> org.springframework.context.support.ClassPathXmlApplicationContext -
> Refreshing
> org.springframework.context.support.ClassPathXmlApplicationContext@6f79caec:
> startup date [Fri Jun 16 07:58:07 CEST 2017]; root of context
> hierarchy INFO :
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader -
> Loading XML bean definitions from class path resource
> [applicationContext.xml] INFO :
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
> - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring Loading class `com.mysql.jdbc.Driver'. This is deprecated.
> The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is
> automatically registered via the SPI and manual loading of the driver
> class is generally unnecessary.INFO :
> org.springframework.jdbc.datasource.DriverManagerDataSource - Loaded
> JDBC driver: com.mysql.jdbc.Driver
> 
> INFO :
> org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean -
> Building JPA container EntityManagerFactory for persistence unit
> 'UP_EBOUTIQUE' INFO : org.hibernate.annotations.common.Version -
> Hibernate Commons Annotations 3.2.0.Final INFO :
> org.hibernate.cfg.Environment - Hibernate 3.6.0.Final INFO :
> org.hibernate.cfg.Environment - hibernate.properties not found INFO :
> org.hibernate.cfg.Environment - Bytecode provider name : javassist
> INFO : org.hibernate.cfg.Environment - using JDK 1.4
> java.sql.Timestamp handling INFO : org.hibernate.ejb.Version -
> Hibernate EntityManager 3.6.0.Final INFO :
> org.hibernate.ejb.Ejb3Configuration - Processing PersistenceUnitInfo [
>   name: UP_EBOUTIQUE  ...] INFO : org.hibernate.cfg.AnnotationBinder -
> Binding entity from annotated class:
> com.msecmaroc.msec.entities.Commande INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Commande on table commande INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Client INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Client on table Client INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Depot INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Depot on table depot INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Ligne_Commande INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Ligne_Commande on table ligne_commande
> INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from
> annotated class: com.msecmaroc.msec.entities.Famille_Dechets INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Famille_Dechets on table famille_dechet
> INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from
> annotated class: com.msecmaroc.msec.entities.Role INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Role on table Role INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Particulier INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Transporteur INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Societe INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Contrat INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Contrat on table contrat INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Type_Traitement INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Type_Traitement on table type_traitement
> INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from
> annotated class: com.msecmaroc.msec.entities.Offre INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Offre on table offre INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Produit INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Produit on table produit INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Type_client INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Type_client on table type_client INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Stock INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Stock on table stock INFO :
> org.hibernate.cfg.AnnotationBinder - Binding entity from annotated
> class: com.msecmaroc.msec.entities.Intervention INFO :
> org.hibernate.cfg.annotations.EntityBinder - Bind entity
> com.msecmaroc.msec.entities.Intervention on table intervention INFO :
> org.hibernate.cfg.annotations.CollectionBinder - Mapping collection:
> com.msecmaroc.msec.entities.Commande.listOperation -> ligne_commande
> INFO : org.hibernate.cfg.annotations.CollectionBinder - Mapping
> collection: com.msecmaroc.msec.entities.Client.commandes -> commande
> INFO : org.hibernate.cfg.annotations.CollectionBinder - Mapping
> collection: com.msecmaroc.msec.entities.Client.listOffre -> offre INFO
> : org.hibernate.cfg.annotations.CollectionBinder - Mapping collection:
> com.msecmaroc.msec.entities.Depot.stock -> stock INFO :
> org.hibernate.cfg.annotations.CollectionBinder - Mapping collection:
> com.msecmaroc.msec.entities.Famille_Dechets.produits -> produit INFO :
> org.hibernate.cfg.annotations.CollectionBinder - Mapping collection:
> com.msecmaroc.msec.entities.Type_Traitement.listeoperation ->
> ligne_commande INFO : org.hibernate.cfg.annotations.CollectionBinder -
> Mapping collection: com.msecmaroc.msec.entities.Offre.listProduit ->
> produit INFO : org.hibernate.cfg.annotations.CollectionBinder -
> Mapping collection: com.msecmaroc.msec.entities.Type_client.client ->
> Client INFO : org.hibernate.cfg.Configuration - Hibernate Validator
> not found: ignoring INFO :
> org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable
> to find org.hibernate.search.event.FullTextIndexEventListener on the
> classpath. Hibernate Search is not enabled. INFO :
> org.springframework.beans.factory.support.DefaultListableBeanFactory -
> Destroying singletons in
> org.springframework.beans.factory.support.DefaultListableBeanFactory@7a187f14:
> defining beans
> [datasource,persistenceUnitManager,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor];
> root of factory hierarchy

的persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_0.xsd ">
    <persistence-unit name="UP_EBOUTIQUE"
        transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

        </properties>
    </persistence-unit>
</persistence>

的applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">


    <!-- Information de la base de donnes -->

    <bean id="datasource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
        <property name="url" value="jdbc:mysql://localhost:3306/msecmaroc"></property>
        <property name="username" value="root"></property>
        <property name="password" value="root"></property>
    </bean>


    <!--Spring configuration -->
    <bean id="persistenceUnitManager"
        class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
        <property name="defaultDataSource" ref="datasource"></property>
        <property name="persistenceXmlLocations">
            <list>
                <value>classpath*:META-INF/persistence.xml</value>
            </list>
        </property>
    </bean>
    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceUnitManager" ref="persistenceUnitManager"></property>
        <property name="persistenceUnitName" value="UP_EBOUTIQUE"></property>
    </bean>
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"></property>
    </bean>
    <tx:annotation-driven transaction-manager="transactionManager" />
    <context:annotation-config></context:annotation-config>
</beans>

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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.msecmaroc</groupId>
    <artifactId>msec</artifactId>
    <name>MsecMarocV1</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <java-version>1.6</java-version>
        <org.springframework-version>3.2.2.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
    </properties>
    <dependencies>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>3.6.0.Final</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.6</version>
        </dependency>

        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Junitclasstest.java

public class testJPA {

    @Test
    public void test1() {
        try {
            ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext(
                    new String[] { "applicationContext.xml" });
            assertTrue(true);
        } catch (Exception e) {
            assertTrue(e.getMessage(),false);
            e.printStackTrace();
        }


    }

}

目前我刚创建了四个实体

User.java

@Entity
@Table(name="user")
public class User implements Serializable{

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long idUser;

    @Column(name="userName" , nullable=false)
    private String userName;

    @Column(name="password" , nullable=false)
    private String password;


    private boolean activated;

    @OneToMany
    @JoinColumn(name="idUser")
    private Collection<Role> roles;



    public Long getIdUser() {
        return idUser;
    }
    public void setIdUser(Long idUser) {
        this.idUser = idUser;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public boolean isActivated() {
        return activated;
    }
    public void setActivated(boolean activated) {
        this.activated = activated;
    }
    public Collection<Role> getRoles() {
        return roles;
    }
    public void setRoles(Collection<Role> roles) {
        this.roles = roles;
    }
    public User() {
        super();
    }
    public User(Long idUser, String userName, String password, boolean activated, Collection<Role> roles) {
        super();
        this.idUser = idUser;
        this.userName = userName;
        this.password = password;
        this.activated = activated;
        this.roles = roles;
    }

}

Role.java

@Entity

public class Role implements Serializable{

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long idRole;
    private String roleName;
    private User user;
    public Role(Long idRole, String roleName, User user) {
        super();
        this.idRole = idRole;
        this.roleName = roleName;
        this.user = user;
    }
    public Role() {
        super();
    }
    public Long getIdRole() {
        return idRole;
    }
    public void setIdRole(Long idRole) {
        this.idRole = idRole;
    }
    public String getRoleName() {
        return roleName;
    }
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
    public User getUser() {
        return user;
    }
    public void setUser(User user) {
        this.user = user;
    }


}

Client.java

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="type_client_soc_par", discriminatorType=DiscriminatorType.STRING)
public class Client implements Serializable {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int idClient;

    @Column(name="matricule", nullable=false)
    private String matricule;

    @Column(name="nomCLient", nullable=false)
    private String nomClient;

    @Column(name="emailCLient", nullable=false)
    private String emailCLient;

    @Column(name="matricule", nullable=false)
    private String numTelephone;

    @Column(name="matricule", nullable=false)
    private String adresse;


    // Constructeur sans parametres
    public Client() {

    }


    public int getIdClient() {
        return idClient;
    }


    public void setIdClient(int idClient) {
        this.idClient = idClient;
    }


    public String getMatricule() {
        return matricule;
    }


    public void setMatricule(String matricule) {
        this.matricule = matricule;
    }


    public String getNomClient() {
        return nomClient;
    }


    public void setNomClient(String nomClient) {
        this.nomClient = nomClient;
    }


    public String getEmailCLient() {
        return emailCLient;
    }


    public void setEmailCLient(String emailCLient) {
        this.emailCLient = emailCLient;
    }


    public String getNumTelephone() {
        return numTelephone;
    }


    public void setNumTelephone(String numTelephone) {
        this.numTelephone = numTelephone;
    }


    public String getAdresse() {
        return adresse;
    }


    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

Societe.java

@Entity
@DiscriminatorValue("Societe")
public class Societe extends Client implements Serializable{

    @Column(name="nomResponsable", nullable=false)
    private String nomResponsable;

    @Column(name="emailResponsable", nullable=false)
    private String emailResponsable;

    @Column(name="telResponsable", nullable=false)
    private String telResponsable;

    @Column(name="nomSuperieur", nullable=false)
    private String nomSuperieur;

    @Column(name="emailSuperieur", nullable=false)
    private String emailSuperieur;

    @Column(name="telSuperieur", nullable=false)
    private String telSuperieur;

    @Column(name="commentaire", nullable=false)
    private String commentaire;

    //constructeur sans parametre
    public Societe() {

    }

    public String getNomResponsable() {
        return nomResponsable;
    }

    public void setNomResponsable(String nomResponsable) {
        this.nomResponsable = nomResponsable;
    }

    public String getEmailResponsable() {
        return emailResponsable;
    }

    public void setEmailResponsable(String emailResponsable) {
        this.emailResponsable = emailResponsable;
    }

    public String getTelResponsable() {
        return telResponsable;
    }

    public void setTelResponsable(String telResponsable) {
        this.telResponsable = telResponsable;
    }

    public String getNomSuperieur() {
        return nomSuperieur;
    }

    public void setNomSuperieur(String nomSuperieur) {
        this.nomSuperieur = nomSuperieur;
    }

    public String getEmailSuperieur() {
        return emailSuperieur;
    }

    public void setEmailSuperieur(String emailSuperieur) {
        this.emailSuperieur = emailSuperieur;
    }

    public String getTelSuperieur() {
        return telSuperieur;
    }

    public void setTelSuperieur(String telSuperieur) {
        this.telSuperieur = telSuperieur;
    }

    public String getCommentaire() {
        return commentaire;
    }

    public void setCommentaire(String commentaire) {
        this.commentaire = commentaire;
    }

有什么奇怪的,如果我删除超类和子类,我只留下角色和用户一切正常并且创建了架构,但是如果我添加这两个类同样的问题发生

0 个答案:

没有答案