Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349337

Summary: [API] CCE generating metamodel classes
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jolene.moffitt, neil.hauge
Version: 3.0Keywords: api
Target Milestone: 3.0.1Flags: neil.hauge: review+
Hardware: PC   
OS: Windows XP   
Whiteboard: fix_ready
Attachments:
Description Flags
stack trace
none
proposed patch against head none

Description Karen Butzke CLA 2011-06-14 11:32:05 EDT
1. Create a Generic 2.0 JPA project with an orm.xml file
2. Set a canonical metamodel source folder on the JPA properties page.
3. Add this JPA entity:
@Entity
public class Bar {

	@Id
	private int id;
}
4. Add the Bar entity to the orm.xml file. The attached CCE appears in the error log.

java.lang.ClassCastException: org.eclipse.jpt.jpa.core.internal.context.orm.VirtualOrmPersistentAttribute cannot be cast to org.eclipse.jpt.jpa.core.context.PersistentAttribute
	at org.eclipse.jpt.jpa.core.internal.jpa2.GenericMetamodelSynchronizer.printAttributesOn(GenericMetamodelSynchronizer.java:345)
Comment 1 Karen Butzke CLA 2011-06-14 11:40:07 EDT
Created attachment 197960 [details]
stack trace
Comment 2 Karen Butzke CLA 2011-06-14 13:01:14 EDT
Created attachment 197965 [details]
proposed patch against head

This patch includes a minor API change: MetamodelSourceType.attributes() generic type had to be changed to ReadOnlyPersistentAttribute from PersistentAttribute. I think this change is warranted because this bug breaks metamodel generation in the orm.xml case if any attribute is not specified in the orm.xml file.
Comment 3 Karen Butzke CLA 2011-06-24 08:07:09 EDT
checked in to HEAD for 3.0.1
Comment 4 Jolene Moffitt CLA 2011-08-04 14:05:58 EDT
Verified in Build I-3.4.0-20110731180834

Verified you add an entity to orm.xml if the canonical metamodel source folder is already set.  See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.0.1