Bonjour,
J'essaie de mettre en place dans mon application l'accès aux données via Spring data avec hibernate.
Lorsque j'essaie de lancer mon application j'ai une erreur lors de la création de mon Bean :
C'est surtout la cause qui m'interpelle : Expecting Collection type.
Code : 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 Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Expecting collection type [[Lcore.object.analytics.MatrixCell;] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at web.bean.testyc.SpringDaoTest.main(SpringDaoTest.java:18) Caused by: java.lang.IllegalArgumentException: Expecting collection type [[Lcore.object.analytics.MatrixCell;] at org.hibernate.ejb.metamodel.AttributeFactory.determineCollectionType(AttributeFactory.java:902) at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:756) at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:737) at org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:520) at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:100) at org.hibernate.ejb.metamodel.MetadataContext.wrapUp(MetadataContext.java:207) at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:83) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:106) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.springframework.orm.jpa.vendor.SpringHibernateEjbPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateEjbPersistenceProvider.java:51) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ... 12 more
Ma classe MatrixRow :
Je me demande si le problème vient pas du fait que mon attribut cells soit un tableau et non une liste
Code : 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 @Entity @Table(name = "MatrixRow", uniqueConstraints = {@UniqueConstraint(columnNames = { "matrix", "rowOrder"})}) @DiscriminatorValue("STANDARD") @Proxy(lazy = false) @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class MatrixRow extends BasicObject { private static final long serialVersionUID = -606817094984648632L; /** * en-tête de colonne */ @Column(name = "header", nullable = false) private String header; /** * Matrice associée */ @ManyToOne(cascade = {CascadeType.ALL}) @LazyCollection(LazyCollectionOption.FALSE) @JoinColumn(name = "matrix", nullable = false) protected Matrix matrix; /** * indique le rang de la ligne par rapport aux autres lignes contenues * dans une matrice */ @Column(name = "rowOrder", nullable = false) protected int rowOrder; /** * L'unité qui est utilisée dans la ligne */ @ManyToOne @LazyCollection(LazyCollectionOption.FALSE) @JoinColumn(name = "unit", nullable = true) protected Unit unit; /** * tableau contenant l'ensemble des valeur d'une ligne */ @OneToMany(mappedBy = "matrixRow", cascade = {CascadeType.ALL}, orphanRemoval = true) @OrderColumn(name = "position", nullable = false) @LazyCollection(LazyCollectionOption.FALSE) private MatrixCell[] cells; ...
Si vous avez des pistes pour régler mon problème je suis preneur.
Merci
Partager