Static Metamodel gencode error ... for wildcard Collection field [message #1027274] |
Tue, 26 March 2013 19:52 |
Claude Bernard Diesse Messages: 9 Registered: December 2011 |
Junior Member |
|
|
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 10:24] Report message to a moderator
|
|
|
Re: Static Metamodel gencode error ... for wildcard Collection field [message #1030654 is a reply to message #1027274] |
Sun, 31 March 2013 14:30 |
Claude Bernard Diesse Messages: 9 Registered: December 2011 |
Junior Member |
|
|
No response since for my question about use of wildcard in JPA 2 collection parameter type ?
I want to know if i am allowed to declare an entity field (@OneToMany relation) using wildcard as follow :
@OneToMany(cascade = CascadeType.ALL, mappedBy = "sourceTranslation") protected List<? extends EntityTranslation> translations;
or if this is forbidden and restricted to this :
@OneToMany(cascade = CascadeType.ALL, mappedBy = "sourceTranslation") protected List<EntityTranslation> translations;
If there is no such limitation, can we say that EclipseLink static metamodel generator have a bug and file a bug in bugzilla ?
Thanks for any help.
[Updated on: Tue, 02 April 2013 09:48] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04269 seconds