You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Laird Nelson <lj...@gmail.com> on 2009/10/23 16:32:18 UTC
ReverseMappingTool: easiest way to produce @MappedSuperclasses?
Where in the customize(ClassMapping) method of ReverseCustomizer would I set
something that would let the code generators downstream know that they
should generate mapped superclasses instead of entities?
Would I install a different ClassStrategy on the mapping?
Thanks,
Laird
Re: ReverseMappingTool: easiest way to produce @MappedSuperclasses?
Posted by ljnelson <lj...@gmail.com>.
On Mon, Nov 2, 2009 at 1:45 AM, Pinaki Poddar [via OpenJPA] <
ml-node+3930219-1947740487@n2.nabble.com<ml...@n2.nabble.com>
> wrote:
> Hi Laird,
> Which version of OpenJPA you are on?
> Why I ask is if you are on trunk, then MappedSuperclass is represented in
> ClassMetaData.setAbstract().
> ReverseCustomizer should set ClassMetaData.setAbstract(true) and annotation
> builder getEntityType() requires to check isAbstract() to return
> MappedSuperclass.
>
Hi; no, unfortunately I'm on *almost* the bleeding edge, but not quite:
1.3.0-SNAPSHOT.
I found a way to do it involving a combination of setEmbeddedOnly(true) and
various calls to syncMappingInfo (otherwise the fields get left off).
Thanks for the tip though; hopefully we'll move to 2.0 soon.
Best,
Laird
--
View this message in context: http://n2.nabble.com/ReverseMappingTool-easiest-way-to-produce-MappedSuperclasses-tp3879078p3931785.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ReverseMappingTool: easiest way to produce @MappedSuperclasses?
Posted by Pinaki Poddar <pp...@apache.org>.
Hi Laird,
Which version of OpenJPA you are on?
Why I ask is if you are on trunk, then MappedSuperclass is represented in
ClassMetaData.setAbstract().
ReverseCustomizer should set ClassMetaData.setAbstract(true) and annotation
builder getEntityType() requires to check isAbstract() to return
MappedSuperclass.
Regards --
Pinaki
ljnelson wrote:
>
> On Fri, Oct 23, 2009 at 11:05 AM, ljnelson [via OpenJPA] <
> ml-node+3879262-1760251060@n2.nabble.com<ml...@n2.nabble.com>
>> wrote:
>
>> I spoke too soon. Setting this to true seems to eliminate all the useful
>> length and nullability information from the resulting annotations.
>>
>
> JIRA filed: https://issues.apache.org/jira/browse/OPENJPA-1360
>
> Best,
> Laird
>
>
-----
Pinaki
--
View this message in context: http://n2.nabble.com/ReverseMappingTool-easiest-way-to-produce-MappedSuperclasses-tp3879078p3930219.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ReverseMappingTool: easiest way to produce @MappedSuperclasses?
Posted by ljnelson <lj...@gmail.com>.
On Fri, Oct 23, 2009 at 11:05 AM, ljnelson [via OpenJPA] <
ml-node+3879262-1760251060@n2.nabble.com<ml...@n2.nabble.com>
> wrote:
> I spoke too soon. Setting this to true seems to eliminate all the useful
> length and nullability information from the resulting annotations.
>
JIRA filed: https://issues.apache.org/jira/browse/OPENJPA-1360
Best,
Laird
--
View this message in context: http://n2.nabble.com/ReverseMappingTool-easiest-way-to-produce-MappedSuperclasses-tp3879078p3879544.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ReverseMappingTool: easiest way to produce @MappedSuperclasses?
Posted by ljnelson <lj...@gmail.com>.
On Fri, Oct 23, 2009 at 10:54 AM, ljnelson [via OpenJPA] <
ml-node+3879205-242295062@n2.nabble.com<ml...@n2.nabble.com>
> wrote:
> On Fri, Oct 23, 2009 at 10:32 AM, ljnelson [via OpenJPA] <[hidden email]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3879205&i=0>
> > wrote:
>
>> Where in the customize(ClassMapping) method of ReverseCustomizer would I
>> set
>> something that would let the code generators downstream know that they
>> should generate mapped superclasses instead of entities?
>>
>
> Looks like
> http://openjpa.apache.org/builds/latest/docs/javadoc/org/apache/openjpa/meta/ClassMetaData.html#setEmbeddedOnly%28boolean%29does the trick.
>
I spoke too soon. Setting this to true seems to eliminate all the useful
length and nullability information from the resulting annotations.
So although instead of:
@Entity
@Table(name = "foo")
public class Foo ... {
@Basic
@Column(nullable = false, length = 4)
private String bar;
}
I get
@MappedSuperclass
@Table
public class Foo ... {
@Basic
private String bar;
}
I guess I'll keep looking.
Laird
--
View this message in context: http://n2.nabble.com/ReverseMappingTool-easiest-way-to-produce-MappedSuperclasses-tp3879078p3879262.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ReverseMappingTool: easiest way to produce @MappedSuperclasses?
Posted by ljnelson <lj...@gmail.com>.
On Fri, Oct 23, 2009 at 10:32 AM, ljnelson [via OpenJPA] <
ml-node+3879078-648912814@n2.nabble.com<ml...@n2.nabble.com>
> wrote:
> Where in the customize(ClassMapping) method of ReverseCustomizer would I
> set
> something that would let the code generators downstream know that they
> should generate mapped superclasses instead of entities?
>
Looks like
http://openjpa.apache.org/builds/latest/docs/javadoc/org/apache/openjpa/meta/ClassMetaData.html#setEmbeddedOnly%28boolean%29does
the trick.
Thanks,
Laird
--
View this message in context: http://n2.nabble.com/ReverseMappingTool-easiest-way-to-produce-MappedSuperclasses-tp3879078p3879205.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.