Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365489 - [Validation] Validation needed for incompatible access type
Summary: [Validation] Validation needed for incompatible access type
Status: NEW
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Neil Hauge CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 16:21 EST by Nan Li CLA
Modified: 2011-12-28 10:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-12-02 16:21:02 EST
Build Identifier: I-3.4.0-20111117042436

Runtime complains incompatible access type under some cases when defining entities with field-based access on property or property-based access on field. Here are a couple of such cases:

Case 1:
@Entity
@Access(AccessType.FIELD)
public class Test implements Serializable {

	private int id;
	private static final long serialVersionUID = 1L;

	public Test() {
		super();
	}   
	
	@Id
	@Access(FIELD)
	public int getId() {
		return this.id;
	}

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

Case 2:
@Entity
@Access(AccessType.PROPERTY)
public class Test implements Serializable {

	   
	@Id
	@Access(AccessType.PROPERTY)
	private int id;
	private static final long serialVersionUID = 1L;

	public Test() {
		super();
	}   

	public int getId() {
		return this.id;
	}

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

At least a warning message should be given to remind the potential problem during runtime. Please note that runtime won't complain once specifying property-based access to the property regardless what else is specified.

Reproducible: Always