Hi all,
What is the behavoir of Entity (access=) when combined with an EmbeddedSuperclass?
Since the EmbeddedSuperclass is not an Entity, I see no way of specifying it's access mode (unless I missed something in the documentation?) I am relatively certain that it defaults to access=PROPERTY. (Annotating the fields does not produce the desired DDL--the superclass columns are not rendered as part of the subclass' corresponding table.)
I also know that the subclass MUST access the EmbeddedSuperclass by property, even if the subclass was annotated Entity(access=FIELD).
Is it safe to assume that field access won't work when using an EmbeddedSuperclass? This is kind of a bummer since I think annotating the fields produces cleaner code, but understandable given Java's introspection capabilities. (I even made the fields in the superclass protected, but that still didn't work!)
Please reference the code examples below:
Code:
@EmbeddedSuperclass
public abstract class MyBaseClass
{
Long id ;
@Id
public Long getLong () { return this.id ; }
public void setLong (Long id) { return this.id = id ; }
}
And I have another class like this:
Code:
@Entity (access=AccessType.FIELD)
public class MyDerivedClass extends MyBaseClass
{
@Column (length = 64)
String name ;
public String getName () { return this.name ; }
public void setName (String name) { this.name = name ; }
}
NOTE: I want "MyDerivedClass" to map to a table that has both id and name columns.