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

Bug 331915

Summary: Allow JPA classes to use both static and dynamic mappings
Product: z_Archived Reporter: Tom Ware <tom.ware>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Rough Patch none

Description Tom Ware CLA 2010-12-06 10:42:53 EST
This enhancement is to allow a class that contains both attributes that use PROPERTIES/FIELDS that are physically defined on the class along with attributes that are defined using dynamic JPA.

e.g.

public class Customer extends DynamicEntityImpl {
    
    private int id;
    private String name;

    public static DynamicPropertiesManager DPM = new DynamicPropertiesManager();
    
    public Customer(){
        super();
    }
    
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    
    public DynamicPropertiesManager fetchPropertiesManager(){
        return DPM;
    }
}


<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.1" xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_1.xsd">
	<entity class="test.model.Customer" access="VIRTUAL">
		<attributes>
			<id name="id" access="FIELD">
			</id>
			<basic name="name" access="FIELD">
			</basic>
			<basic name="company" attribute-type="String" access="VIRTUAL">
            </basic>
		</attributes>
	</entity>
</entity-mappings>


Notice that <basic name="company" attribute-type="String" access="VIRTUAL"> defines a virtual field and that Customer subclasses
DynamicEntityImpl
Comment 1 Tom Ware CLA 2010-12-06 10:44:02 EST
Created attachment 184615 [details]
Rough Patch

Attached a rough patch that address issues with our metadata processing code that disallows coexistence of static and dynamic fields
Comment 2 Tom Ware CLA 2010-12-06 11:19:31 EST
Still requires investigation:

Having propertiesMap only contain dynamic fields

Weaving: DynamicEntityImpl implements weaving interfaces.  How will weaving of
the static class interact with this?
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:35:00 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink