openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2305) Canonical MetaModel class generation should not use inhertence
Date Fri, 01 Mar 2013 20:37:13 GMT


Pinaki Poddar commented on OPENJPA-2305:

As per spec, the inheritance hierarchy of the generated metamodel class must mirror that of
the domain classes. However we need exact class as the generic parameter of the declared meta-fields.
So the solution is as follows

@Entity public class Base { private int x;}
@Entity public class Derived extends Base {}

public class Base_ {public static volatile SingularAttribute<Base,Integer> x;}
public class derived_ extends Base_ {public static volatile SingularAttribute<Derived,Integer>
x;} // rewrite the base variable with owning class as generic parameter
> Canonical MetaModel class generation should not use inhertence
> --------------------------------------------------------------
>                 Key: OPENJPA-2305
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: criteria
>    Affects Versions:
>            Reporter: Pinaki Poddar
>            Assignee: Pinaki Poddar
>             Fix For: 2.3.0,
> The generated source code for canonical metamodel classes mirrored the same inheritance
hierarchy of the domain classes. This strategy exposed an error that resulted in wrong target
SQL query under the following domain model 
> a) A @MappedSuperClass M defined a primary key field x
> b) The primary key field x is an @EmbeddedId E
> c) An @Entity class D derived from M and navigated to the fields of E via x
> The solution is to generate canonical class as a flattened structure instead
of inheriting from (as is done currently). 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message