Static Metamodel gencode error ... for wildcard Collection field [message #1027274] |
Tue, 26 March 2013 15:52  |
Eclipse User |
|
|
|
Hi All,
I wonder if i am missing something, but I used to declare in the past, some Entity's collection fields using wildcard parameter type. But actually, the EclipseLink metamodel processor generates wrong code from that fields declaration
example:
Original entity classes :
package model.base;
@Entity @Table(name = "MOMAP")
public class MetaEntity extends BaseEntity<Long> {
private static final long serialVersionUID = 1L;
@ManyToOne(optional = false) @JoinColumn(table = "MOMETA", name = "TID", referencedColumnName = "ID") private EntityType entType;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "sourceTranslation") protected List<? extends EntityTranslation> translations;
}
The generated static metamodel code look like this :
package model.base;
import ? extends model.base.EntityTranslation;
import com.kasor.model.base.EntityType;
import javax.annotation.Generated;
import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.4.1.v20121003-rNA", date="2013-03-26T19:41:30")
@StaticMetamodel(MetaEntity.class)
public class MetaEntity_ extends BaseEntity_ {
public static volatile SingularAttribute<MetaEntity, EntityType> entType;
public static volatile ListAttribute<MetaEntity, EntityTranslation> translations;
}
As it is showed in the import line of the generated code, the processor don't correctly recognize the wildcard parameter in the List field declaration.
My Questions :
1. Does JPA specs allow/limit use of wildcard/bounded parameters for collection fields ?
2. Is this a bug or limitation of the eclipseLink static metamodel generator/processor ?
I searched in JPA 2 specifications and found no hint restricting the use of wilcard or bounded type parameters.
When I change the definition to :
@OneToMany(cascade = CascadeType.ALL, mappedBy = "sourceTranslation") protected List<EntityTranslation> translations;
The processor correctly generate the static metamodel files.
I also dont' have any warning from a regular javac source compilation of my entity classes ...
May someone share his thought about this and/or help for a workaround ?
regards.
[Updated on: Thu, 28 March 2013 06:24] by Moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03967 seconds