Community
Participate
Working Groups
1. Entity class must have a no-arg public or protected constructor 2. Entity class must be a top-level class 3. Entity class must not be final. no methods or persistent instance variables of the entity class may be final(does it matter whether you use field/method access for this??) 4.Instance variables must be private, protected, or package visibility 5.Persistent field must have JavaBeans style accessor methods and vice versa. 6.Mapping annotations applied to both persistent fields and properties, should this be an error?
(In reply to comment #0) > 1. Entity class must have a no-arg public or protected constructor EclipseLink handles a private no-arg constructor as well. > 2. Entity class must be a top-level class EclipseLink supports member classes as long as they are static. We should handle this with validation instead of filtering them out as we do now. > 3.Entity class must not be final. no methods or persistent instance variables > of the entity class may be final(does it matter whether you use field/method > access for this??) EclipseLink supports final classes, so only the Generic platform should have an error or maybe even just a warning that this isn't portable/spec compliant. > 4.Instance variables must be private, protected, or package visibility EclipseLink allows public instance variables, though maybe they should have an error? We already have a validation error for public instance variables. > 5.Persistent field must have JavaBeans style accessor methods and vice versa. We handle this via filtering, another bug should be entered if we want to handle it differently. > 6.Mapping annotations applied to both persistent fields and properties, should > this be an error? Mixed access type is now supported, this no longer applies.
(In reply to comment #1) > (In reply to comment #0) > > 1. Entity class must have a no-arg public or protected constructor > EclipseLink handles a private no-arg constructor as well. Will support this for Entity, Embeddable and MappedSuperclass. In the errors just substitute embeddable or mapped superclass for entity if appropriate. In Generic and EL if there is no no-arg constructor you will get error: "The java class for entity <entity-name> has no no-arg constructor defined" In Generic if there is a private no-arg constructor you will get error: "The java class for entity <entity-name> has a private no-arg constructor; it must be public or protected." > > 2. Entity class must be a top-level class > EclipseLink supports member classes as long as they are static. We should > handle this with validation instead of filtering them out as we do now. Will support this for Entity, Embeddable and MappedSuperclass. In the errors just substitute embeddable or mapped superclass for entity if appropriate. In Generic if you annotate a member class, static or not you will get error: The java class for entity <entity-name> is a member type In EclipseLink if you annotate a non-static member class, you will get error: The java class for entity <entity-name> is a non-static member type > > 3.Entity class must not be final. no methods or persistent instance > > variables of the entity class may be final(does it matter whether you use > > field/method access for this??) > EclipseLink supports final classes, so only the Generic platform should have > an error or maybe even just a warning that this isn't portable/spec compliant. A Generic final entity will have this error: The java class for entity <entity-name> is final A Generic final embeddable will have this error: The java class for embeddable <embeddable-name> is final A Generic/EclipseLink final mapped supperclass will have this error: The java class for mapped superclass <mapped-superclass-name> is final > > 4.Instance variables must be private, protected, or package visibility > EclipseLink allows public instance variables, though maybe they should have an > error? We already have a validation error for public instance variables. A Generic public persistent field will have error message: The java field for attribute <attribute-name> is public A Generic public persistent getter will have error message: The get method for attribute <attribute-name> is public > >5.Persistent field must have JavaBeans style accessor methods and vice versa. > We handle this via filtering, another bug should be entered if we want to > handle it differently. Handle this with bug 227160 > > 6.Mapping annotations applied to both persistent fields and properties, > > should this be an error? > Mixed access type is now supported, this no longer applies. Handle this with bug 323527
I am also adding all of these validation messages to our Validation Preferences
number 3. will also include: A Generic final persistent field will have error message: The java field for attribute <attribute-name> is final A Generic final persistent getter will have error message: The get method for attribute <attribute-name> is final
fixed for 3.0M2
Verified in Build I-3.3.0-20101021033924 Note that the validation message is not mapping type specific. See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.0_M2