IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Java EE Discussion :

Problème de génération des tables à partir des classes entities (JavaEE, Oracle 10g)


Sujet :

Java EE

  1. #1
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut Problème de génération des tables à partir des classes entities (JavaEE, Oracle 10g)
    Bonjour tous le monde

    je suis en train de réaliser un projet avec javaEE(Hibernate,Spring,JSF) pour mon stage (PFE) ,je veux générer des tables à partir des classes entities
    au début j'ai testé avec MySQL et ça marchait à merveille .
    maintenant je veux switcher vers oracle 10g (ce qui est exigé dans le cahier de charges) .
    lorsque j’exécute le test avec JUnit ,un message d'erreur s'affiche.
    ci-dessous :
    .ma classe entitie (Course.java)
    .mon fichier: applicationContext.xml
    .la classe de test .
    Code Course.java : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
     
    package fr.sewatech.university.model;
     
    // Generated 1 mars 2012 22:26:12 by Hibernate Tools 3.4.0.CR1
     
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
     
    import static javax.persistence.GenerationType.IDENTITY;
    import javax.persistence.Id;
    import javax.persistence.Table;
     
    /**
     * Course generated by hbm2java
     */
     
    @Entity
    @Table(name = "course")
    public class Course implements java.io.Serializable {
     
    	private Integer id;
    	private String code;
    	private String name;
    	private Integer length;
     
     
    	public Course() {
    	}
     
    	public Course(String code, String name) {
    		this.code = code;
    		this.name = name;
    	}
     
    	public Course(String code, String name, Integer length, Integer teacherId) {
    		this.code = code;
    		this.name = name;
    		this.length = length;
    		//this.teacherId = teacherId;
    	}
     
    	@Id
    	@GeneratedValue(strategy = GenerationType.SEQUENCE)
    	@Column(name = "id", unique = true, nullable = false)
    	public Integer getId() {
    		return this.id;
    	}
     
    	public void setId(Integer id) {
    		this.id = id;
    	}
     
    	@Column(name = "code", nullable = false, length = 10)
    	public String getCode() {
    		return this.code;
    	}
     
    	public void setCode(String code) {
    		this.code = code;
    	}
     
    	@Column(name = "name", nullable = false, length = 30)
    	public String getName() {
    		return this.name;
    	}
     
    	public void setName(String name) {
    		this.name = name;
    	}
     
    	@Column(name = "length")
    	public Integer getLength() {
    		return this.length;
    	}
     
    	public void setLength(Integer length) {
    		this.length = length;
    	}
     
    	@Override
    	public String toString() {
    		// TODO Auto-generated method stub
    		return this.code + "   " + this.name + "\n" ;
    	}
    voici mon applicationContext.xml
    Code applicationContext.xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
     
    <?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:aop="http://www.springframework.org/schema/aop"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:jee="http://www.springframework.org/schema/jee"
    	xmlns:jms="http://www.springframework.org/schema/jms"
    	xmlns:lang="http://www.springframework.org/schema/lang"
    	xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:util="http://www.springframework.org/schema/util"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
    		http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd
    		http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
     
     
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url" value="jdbc:oracle:thin:@localhost:1521:XE"/>
    		<property name="username" value="system" />
    		<property name="password" value="123" />
    </bean>
     
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    		<property name="dataSource" ref="dataSource" />
    		<property name="annotatedClasses">
    			<list>
    				<value>fr.sewatech.university.model.Course</value>
     
    			</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
    				  <prop key="hibernate.show_sql">true</prop>
    			      <prop key="hibernate.hbm2ddl.auto">create</prop> 
    			      <!--  <prop key="hibernate.jdbc.batch_size">0</prop>   -->
    			</props>
    		</property>
     
    	</bean>
     
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    	<tx:annotation-driven transaction-manager="transactionManager"/>
     
    	<context:annotation-config />
        <context:component-scan base-package="echo" />
        <context:component-scan base-package="fr.sewatech.university" />
        <context:component-scan base-package="sales" />
        <context:component-scan base-package="state" />
        <context:component-scan base-package="other" />
     
     
    </beans>

    et voici la classe de test :
    Code CourseServiceTest.java : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
     
    package fr.sewatech.university.service;
     
    import static org.junit.Assert.*;
     
    import java.util.List;
     
    import org.junit.AfterClass;
    import org.junit.BeforeClass;
    import org.junit.Test;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
     
    import fr.sewatech.university.model.Course;
     
    public class CourseServiceTest {
     
     
    	private static ClassPathXmlApplicationContext context;
    	private static CourseService courseService;  
     
     
    	@BeforeClass
    	public static void setUpBeforeClass() throws Exception {
    		context = new ClassPathXmlApplicationContext("applicationContext.xml");
    		courseService = (CourseService) context.getBean("courseService");
    	}
     
    	@AfterClass
    	public static void tearDownAfterClass() throws Exception {
    		context.close();
    	}
     
     
     
    	@Test
    	public void testSave() {
    		Course course = new Course("Ajax","practical RicheFaces 4.2.1");
    		courseService.save(course);
    		assertNotNull(course.getId());
    	}
     
    }

    et là l’intégralité de l'erreur affichée
    Code erreur affichée côté Console : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
     
    mars 27, 2012 9:56:21 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
    Infos: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@12c9b4d1: display name [org.springframework.context.support.ClassPathXmlApplicationContext@12c9b4d1]; startup date [Tue Mar 27 09:56:21 WET 2012]; root of context hierarchy
    mars 27, 2012 9:56:23 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    Infos: Loading XML bean definitions from class path resource [applicationContext.xml]
    mars 27, 2012 9:56:23 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
    Infos: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@12c9b4d1]: org.springframework.beans.factory.support.DefaultListableBeanFactory@3446ca65
    mars 27, 2012 9:56:24 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
    Infos: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3446ca65: defining beans [dataSource,sessionFactory,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.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,cityBean,counterBean,echoBean,inplaceInputBean,courseService,courseBean]; root of factory hierarchy
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.annotations.Version <clinit>
    Infos: Hibernate Annotations 3.3.1.GA
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.Environment <clinit>
    Infos: Hibernate 3.2.5
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.Environment <clinit>
    Infos: hibernate.properties not found
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.Environment buildBytecodeProvider
    Infos: Bytecode provider name : cglib
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.Environment <clinit>
    Infos: using JDK 1.4 java.sql.Timestamp handling
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.AnnotationBinder bindClass
    Infos: Binding entity from annotated class: fr.sewatech.university.model.Course
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.annotations.EntityBinder bindTable
    Infos: Bind entity fr.sewatech.university.model.Course on table course
    mars 27, 2012 9:56:24 AM org.hibernate.cfg.AnnotationConfiguration secondPassCompile
    Infos: Hibernate Validator not found: ignoring
    mars 27, 2012 9:56:24 AM org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
    Infos: Building new Hibernate SessionFactory
    mars 27, 2012 9:56:24 AM org.hibernate.connection.ConnectionProviderFactory newConnectionProvider
    Infos: Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: RDBMS: Oracle, version: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: JDBC driver: Oracle JDBC driver, version: 10.2.0.4.0
    mars 27, 2012 9:56:25 AM org.hibernate.dialect.Dialect <init>
    Infos: Using dialect: org.hibernate.dialect.Oracle10gDialect
    mars 27, 2012 9:56:25 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    Infos: Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
    mars 27, 2012 9:56:25 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    Infos: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Automatic flush during beforeCompletion(): disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Automatic session close at end of transaction: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: JDBC batch size: 15
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: JDBC batch updates for versioned data: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Scrollable result sets: enabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: JDBC3 getGeneratedKeys(): disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Connection release mode: auto
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Default batch fetch size: 1
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Generate SQL with comments: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Order SQL updates by primary key: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Order SQL inserts for batching: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
    Infos: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    mars 27, 2012 9:56:25 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
    Infos: Using ASTQueryTranslatorFactory
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Query language substitutions: {}
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: JPA-QL strict compliance: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Second-level cache: enabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Query cache: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory createCacheProvider
    Infos: Cache provider: org.hibernate.cache.NoCacheProvider
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Optimize cache for minimal puts: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Structured second-level cache entries: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Echoing all SQL to stdout
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Statistics: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Deleted entity synthetic identifier rollback: disabled
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Default entity-mode: pojo
    mars 27, 2012 9:56:25 AM org.hibernate.cfg.SettingsFactory buildSettings
    Infos: Named query checking : enabled
    mars 27, 2012 9:56:25 AM org.hibernate.impl.SessionFactoryImpl <init>
    Infos: building session factory
    mars 27, 2012 9:56:26 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance
    Infos: Not binding factory to JNDI, no JNDI name configured
    mars 27, 2012 9:56:26 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
    Infos: Running hbm2ddl schema export
    mars 27, 2012 9:56:26 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
    Infos: exporting generated schema to database
    mars 27, 2012 9:56:26 AM org.hibernate.tool.hbm2ddl.SchemaExport create
    Grave: Unsuccessful: create table course (id number(10,0) not null unique, code varchar2(10 char) not null, length number(10,0), name varchar2(30 char) not null, primary key (id))
    mars 27, 2012 9:56:26 AM org.hibernate.tool.hbm2ddl.SchemaExport create
    Grave: ORA-02261: une telle clé unique ou primaire existe déjà dans la table
     
    mars 27, 2012 9:56:26 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
    Infos: schema export complete
    mars 27, 2012 9:56:26 AM org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
    Infos: Using DataSource [org.apache.commons.dbcp.BasicDataSource@71d2102a] of Hibernate SessionFactory for HibernateTransactionManager
    Hibernate: select hibernate_sequence.nextval from dual
    Hibernate: insert into course (code, length, name, id) values (?, ?, ?, ?)
    mars 27, 2012 9:56:26 AM org.hibernate.util.JDBCExceptionReporter logExceptions
    Avertissement: SQL Error: 942, SQLState: 42000
    mars 27, 2012 9:56:26 AM org.hibernate.util.JDBCExceptionReporter logExceptions
    Grave: ORA-00942: Table ou vue inexistante
     
    mars 27, 2012 9:56:26 AM org.hibernate.util.JDBCExceptionReporter logExceptions
    Avertissement: SQL Error: 942, SQLState: 42000
    mars 27, 2012 9:56:26 AM org.hibernate.util.JDBCExceptionReporter logExceptions
    Grave: ORA-00942: Table ou vue inexistante
     
    mars 27, 2012 9:56:26 AM org.hibernate.event.def.AbstractFlushingEventListener performExecutions
    Grave: Could not synchronize database state with session
    org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy20.save(Unknown Source)
    	at fr.sewatech.university.service.CourseServiceTest.testSave(CourseServiceTest.java:52)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	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.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Caused by: java.sql.BatchUpdateException: ORA-00942: Table ou vue inexistante
     
    	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10768)
    	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
    	... 41 more
     
    mars 27, 2012 9:56:26 AM org.springframework.context.support.AbstractApplicationContext doClose
    Infos: Closing org.springframework.context.support.ClassPathXmlApplicationContext@12c9b4d1: display name [org.springframework.context.support.ClassPathXmlApplicationContext@12c9b4d1]; startup date [Tue Mar 27 09:56:21 WET 2012]; root of context hierarchy
    mars 27, 2012 9:56:26 AM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
    Infos: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3446ca65: defining beans [dataSource,sessionFactory,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.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,cityBean,counterBean,echoBean,inplaceInputBean,courseService,courseBean]; root of factory hierarchy
    mars 27, 2012 9:56:26 AM org.springframework.orm.hibernate3.AbstractSessionFactoryBean destroy
    Infos: Closing Hibernate SessionFactory
    mars 27, 2012 9:56:26 AM org.hibernate.impl.SessionFactoryImpl close
    Infos: closing
    Code erreur affichée côté JUNIT trace failure : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
     
    org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
    	at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:630)
    	at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:789)
    	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:663)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy20.save(Unknown Source)
    	at fr.sewatech.university.service.CourseServiceTest.testSave(CourseServiceTest.java:52)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	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.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)
    	... 33 more
    Caused by: java.sql.BatchUpdateException: ORA-00942: Table ou vue inexistante
     
    	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10768)
    	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
    	... 41 more
    Visiblement il ne trouve pas la table ,alors que il est censé de la créer .
    autre remarque;je vois une contradiction dans l'erreur affcihée, d'une part : lla création de la table a echoué
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     Grave: Unsuccessful: create table course (id number(10,0) not null unique, code varchar2(10 char) not null, length number(10,0), name varchar2(30 char) not null, primary key (id))
    ensuite il dit que
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Grave: ORA-02261: une telle clé unique ou primaire existe déjà dans la table
    .


    S'il vous plait j'ai besoin de votre aide

  2. #2
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut
    j'ai Résolu mon problème

    après avoir balayé tous le web vainement, j'ai mis la lumière sur cette ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
    visiblement il y a un problème de syntaxe SQL ,
    et puisque j'ai aucune idée sur l'origine de l'erreur j'ai procédé comme suit :j'ai modifié ma classe entitie, de telle sorte qu'elle contienne le minimum de colonnes (attributs ) ,donc j'ai gardé seulement l'attribut : id ,et code ,et je leur ai associé le strict nécessaire d'annotations :
    Code comme ceci : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    	@Id
          //  @GeneratedValue(strategy = GenerationType.AUTO)  j'ai mis ça en     commentaire
    	@Column(name = "id")
    	public Integer getId() {
    		return this.id;
    	}
    @Column(name = "code")
    	public String getCode() {
    		return this.code;
    	}
    lorsque le test a réussi avec ce minimum de code, j'ai ajouté d'autres annotations une par une , je sais que cette méthode n'est pas professionnelle ,mais bon elle a résolu un problème ,c l'essentiel

  3. #3
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut
    Bonjour , Aujourd'hui j'ai eu le même problème ,mais je l'ai résolu comme avant.
    ça prouve que ce n'est pas la bonne solution,
    Par conséquent j'ai toujours besoin de votre aide

  4. #4
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut
    tout simplement Oracle ne reconnait pas la stratégie : IDENTITY
    il faut changer de strategie par exemple prendre : AUTO (par defaut) ou bien Table.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Eclipse / JBoss - Derby] Générer des tables à partir des entités
    Par Hole_geek dans le forum Persistance des données
    Réponses: 4
    Dernier message: 15/05/2012, 16h12
  2. Réponses: 3
    Dernier message: 09/03/2009, 16h43
  3. Réponses: 3
    Dernier message: 13/09/2007, 18h11
  4. Génération de tables à partir des classes
    Par bbo1991 dans le forum Rational
    Réponses: 6
    Dernier message: 02/03/2007, 12h10
  5. Réponses: 3
    Dernier message: 23/01/2007, 08h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo