Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Abstract entities, revisited

It's not the case that an abstract class has no concrete entity subclasses.
In my case, the abstract class which has been pointed as error does have concrete subclasses, and it surprised me that EL didn't accept it...
I was using OpenJPA, and it didn't complained about this.

Luis Fernando Planella Gonzalez

> Please feel free to file an enhancement request to have the case where an 
> abstract entity has no entity subclasses be reported as a validation issue.
> 
> I do not think there is any such TCK test.
> 
> -Tom
> 
> Luis Fernando Planella Gonzalez wrote:
> > I was not registered on the mailing list, so I couldn't reply to the thread at http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg04346.html
> > I'm also facing this issue: we have several abstract base entities with and concrete subclasses, and we are migrating to Glassfish v3.
> > EclipseLink raises an error indicating that there should be a public no-arg constructor, or there was an error invoking the constructor.
> > 
> > However, the JPA 2.0 specification states, on section 2.11.1 Abstract Entity Classes:
> > "An abstract class can be specified as an entity. An abstract entity differs from a concrete entity only in
> > that it cannot be directly instantiated. An abstract entity is mapped as an entity and can be the target of
> > queries (which will operate over and/or retrieve instances of its concrete subclasses).
> > An abstract entity class is annotated with the Entity annotation or denoted in the XML descriptor as
> > an entity."
> > 
> > About the question by Tom Ware on http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg04349.html asking "What is the behavior when one of these objects is read from the database? i.e. if neither of the subclasses is an entity, what is the class of the instance you get back from the DB when you read?", probably there should be a validation that abstract entities have at least one concrete subclass in the same entity manager factory. Otherwise, runtime exceptions could be raised.
> > 
> > Shouldn't the TCK tests catch things like this?
> > 
> > 
> > Luis Fernando Planella Gonzalez
> > _______________________________________________
> > eclipselink-users mailing list
> > eclipselink-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 


Back to the top