openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laird Nelson (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called
Date Tue, 27 Oct 2009 19:30:59 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770617#action_12770617
] 

Laird Nelson edited comment on OPENJPA-1360 at 10/27/09 7:30 PM:
-----------------------------------------------------------------

Talking to myself it seems....  :-)

I've successfully implemented the workaround as described in my prior comment.

The isMappingMode(ClassMetaData) method of my serializer now looks like this:

@Override
public boolean isMappingMode(final ClassMetaData meta) {
  return 
    this.isMappingMode() && 
    (meta.getSourceMode() & MetaDataModes.MODE_MAPPING) != 0 &&
    (meta.getEmbeddingMetaData() == null || this.isMappingMode(meta.getEmbeddingMetaData()));
}

      was (Author: ljnelson):
    Talking to myself it seems....  :-)

I've successfully implemented the workaround as described in my prior comment.

The isMappingMode(ClassMetaData) method of my serializer now looks like this:

<pre>
@Override
  public boolean isMappingMode(final ClassMetaData meta) {
    return 
      this.isMappingMode() && 
      (meta.getSourceMode() & MetaDataModes.MODE_MAPPING) != 0 &&
      (meta.getEmbeddingMetaData() == null || this.isMappingMode(meta.getEmbeddingMetaData()));
  }
</pre>
  
> ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is
called
> ---------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1360
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1360
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: tooling
>    Affects Versions: 1.3.0, 2.0.0
>            Reporter: Laird Nelson
>
> In my ReverseCustomizer, I call classMapping.setEmbedded(true).  This is because for
a variety of reasons I need the code that is generated by the ReverseMappingTool to be @MappedSuperclasses,
not @Entities.
> Indeed when I do this, the resulting class is a @MappedSuperclass (great!) BUT all of
the length and nullable and other @Column attributes are missing.  In other words, all simple
fields receive only a @Basic annotation, with no attributes, and nothing else.  In addition,
the class declaration receives a @Table annotation with no attributes.  (I'm using the command
line flag that instructs the ReverseMappingTool to generate annotations.)
> Ideally I'd like the generated source code to look identical to the source code that
would be generated for a ClassMapping where setEmbedded(true) was never called, except of
course that I want the @Entity annotation to be replaced with @MappedSuperclass.
> Obviously if there is a better way from within a ReverseCustomizer for me to accomplish
my (very odd) goals (mandated by a strange development process and a 30-year-old database),
I am all ears.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message