This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Look at the attached .png. It shows both the error displayed and the log of the successful compile. Project is AstroPersist. AspectdisplayData is serializable. I am changing a map mapping so the value is a column rather than its Entity. The error showed up when I added the @ElementCollection annotation. This is what I what it used to be //@OneToMany //@JoinTable(name = "ASPECTDISPLAY", // joinColumns = {@JoinColumn(name = "CHART_ID", // referencedColumnName = "ID", nullable = false)}) //@MapKeyJoinColumn(name = "EVENT_ID", nullable=false) //private Map<Event, Aspectdisplay> aspectdisplayMap; This is what I'm converting to (not complete) // VALUE IS OBJECT RATHER THAN ENTITY @ElementCollection(targetClass = AspectdisplayData.class) @CollectionTable @MapKeyJoinColumn(name = "EVENT_ID", nullable=false) private Map<Event, AspectdisplayData> aspectdisplayDataMap;
Created attachment 88235 [details] popup error but good compile
yes, it's valid java class and should be compilable, but it's not valid entity class and may fail to works correctly, all details are in tooltip. what behavior do you expect? in my opinion it's not an issue.
> it's not valid entity class ... all details are in tooltip. But its looking for a "Basic attribute" as it says in the tooltip not an entity, and AspectDisplayData is serializable. In the spec 2.7.2 Map Values When the value type of the map is a basic type or an embeddable class, a collection table is used to map the map. If Java generic types are not used, the ElementCollection annotation must specify the value type for the map. The default column mappings for the map value are derived according to the default mapping rules for the CollectionTable annotation The error flags started showing up as soon as I added the "@ElementCollection annotation. This is what I think is the correct mapping (but there still an SQL issue from eclipselink, but eclipselink isn't done with the Map<key,val> relations). This is very similar to example 2 in section 11.1.31 MapKeyJoinColumn Annotation. @ElementCollection //(targetClass = AspectdisplayData.class) @Column(name="DAT") @CollectionTable(name = "ASPECTDISPLAY") @MapKeyJoinColumn(name = "EVENT_ID", nullable=false) private Map<Event, AspectdisplayData> aspectdisplayDataMap;
ok, need to reevaluate, but it's not "error but compiles issue" then.
> not "error but compiles issue" hope changed summary makes more sense
may be similar to issue 167419
The eclipselink issues are resolved and now I'm able to use @ElementCollection. I put the "TargetMilestone" back to TDB since it was initially set to "next" when you thought it "may fail to works correctly" (and the related issue 167419 was marked "next" on 6.7). It is difficult to work with a file that has error markings (a psychological issue I guess). Here is a more complete example; it executes correctly (good SQL) with eclipselink M10 (possibly works with earlier release). @Entity @Table(name = "CHART", catalog = "", schema = "ERNIE") public class Chart implements Serializable { private static final long serialVersionUID = 1L; ... @ElementCollection @CollectionTable(name="ASPECTDISPLAY", schema = "ERNIE", joinColumns=@JoinColumn(name="CHART_ID")) @MapKeyJoinColumns( @MapKeyJoinColumn(name = "EVENT_ID", nullable=false, updatable=false)) private Map<Event, Aspectdisplay> aspectdisplayMap; ~~~~~~~~~~~~~~~~ NOT REALLY AN ERROR @Embeddable public class Aspectdisplay implements Serializable { private static final long serialVersionUID = 1L; @Basic(optional = false) @Lob @Column(name = "DAT", nullable = false) private AspectdisplayData dat;
can you provide complete code?
Created attachment 90321 [details] project with problem
Attached zip file with project. Chart.java is the file with the @ElementCollection.
thanks, will look now.
error will not be shown now http://hg.netbeans.org/web-main/rev/0d2f5cbcce03 but this area still have an issue, verification of attribtes with ElementCollection isn't supported yet, may need to be filed as new issue and can be addressed in next release only as it requires new hint messages.
Integrated into 'main-golden', will be available in build *200911060201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/0d2f5cbcce03 User: sergeyp@netbeans.org Log: fix #172943 - if element is marked with ElementCollection annotation no error will be shown based on attrinbute type, need to add proper verification of ElementCollection attributes in next realease