You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Laird Nelson (JIRA)" <ji...@apache.org> on 2009/10/23 17:54:59 UTC

[jira] Created: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

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.


[jira] Resolved: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods resolved OPENJPA-1360.
-----------------------------------

    Resolution: Fixed

> 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.2.2
>            Reporter: Laird Nelson
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1360-trunk.patch
>
>
> 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.


[jira] Updated: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1360:
----------------------------------

    Fix Version/s:     (was: 2.0.0)
                   2.0.0-beta3

> 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.2.2
>            Reporter: Laird Nelson
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.0-beta3
>
>         Attachments: OPENJPA-1360-trunk.patch
>
>
> 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.


[jira] Commented: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769380#action_12769380 ] 

Laird Nelson commented on OPENJPA-1360:
---------------------------------------

I think there may be something wrong with MetaDataRepository.java line 727 and 728.  The comment reads:
            // embedded-only metadata doesn't have mapping, so always loaded

Immediately beneath that is a block that then proceeds to do some sophisticated loading of metadata in the event a ClassMetaData is NOT set to be embedded only.

As it turns out, a MappedSuperclass is allowed, right?, to "have mapping".  Specifically, a MappedSuperclass may certainly have @Column annotations.

So I think that whatever magic machinery (and I've gone goggle eyed trying to figure out exactly what that machinery is) below this point that is responsible for loading up the information necessary to determine that a @Column annotation should be output is being short-circuited.

> 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.


[jira] Commented: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770234#action_12770234 ] 

Laird Nelson commented on OPENJPA-1360:
---------------------------------------

It looks like, at least for the annotations path, AnnotationPersistenceMetaDataSerializer is the culprit.  At line 202 or thereabouts, in the isMappingMode(ClassMetaData meta) method, it includes a check to see if the supplied meta isEmbeddedOnly().  If it is, then there is nothing else you can do from the standpoint of your ReverseCustomizer: that metdata is deemed to NOT be in mapping mode.  That of course means that when the Java code is written out, all fields are output with only a @Basic annotation and nothing else.

The (rather cumbersome) workaround is to subclass both this serializer and PersistenceMappingFactory and supply a PersistenceMappingFactory implementation that returns new instances of an AnnotationPersistenceMetaDataSerializer that is capable of omitting this isEmbeddedOnly() check from its own implementation of the isMappingMode(ClassMetaData meta) method.

> 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.


[jira] Updated: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Laird Nelson updated OPENJPA-1360:
----------------------------------

    Comment: was deleted

(was: I think there may be something wrong with MetaDataRepository.java line 727 and 728.  The comment reads:
            // embedded-only metadata doesn't have mapping, so always loaded

Immediately beneath that is a block that then proceeds to do some sophisticated loading of metadata in the event a ClassMetaData is NOT set to be embedded only.

As it turns out, a MappedSuperclass is allowed, right?, to "have mapping".  Specifically, a MappedSuperclass may certainly have @Column annotations.

So I think that whatever magic machinery (and I've gone goggle eyed trying to figure out exactly what that machinery is) below this point that is responsible for loading up the information necessary to determine that a @Column annotation should be output is being short-circuited.)

> 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.


[jira] Work started: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on OPENJPA-1360 started by Donald Woods.

> 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.2.2
>            Reporter: Laird Nelson
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1360-trunk.patch
>
>
> 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.


[jira] Commented: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770617#action_12770617 ] 

Laird Nelson commented on OPENJPA-1360:
---------------------------------------

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:

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

> 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.


[jira] Issue Comment Edited: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1360:
----------------------------------

    Affects Version/s:     (was: 2.0.0)
                           (was: 1.3.0)
                       1.2.2
        Fix Version/s: 2.0.0
                       1.3.0
             Assignee: Donald Woods

> 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.2.2
>            Reporter: Laird Nelson
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.0
>
>
> 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.


[jira] Updated: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1360:
----------------------------------

    Attachment: OPENJPA-1360-trunk.patch

Proposed patch based on 1.3.x changes.  Need to run a full set of junits and TCK before committing to trunk.

> 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.2.2
>            Reporter: Laird Nelson
>            Assignee: Donald Woods
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1360-trunk.patch
>
>
> 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.


[jira] Commented: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806487#action_12806487 ] 

Laird Nelson commented on OPENJPA-1360:
---------------------------------------

This bug is still present in openjpa 1.2.2, even with the new ClassMapping.isAbstract() method.

> 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.


[jira] Issue Comment Edited: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ 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:

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

      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:

{code}
@Override
  public boolean isMappingMode(final ClassMetaData meta) {
    return 
      this.isMappingMode() && 
      (meta.getSourceMode() & MetaDataModes.MODE_MAPPING) != 0 &&
      (meta.getEmbeddingMetaData() == null || this.isMappingMode(meta.getEmbeddingMetaData()));
  }
{/code}
  
> 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.


[jira] Issue Comment Edited: (OPENJPA-1360) ReverseMappingTool omits nullable, length, etc. when ClassMapping.setEmbedded(true) is called

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ 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:

<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>

      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:

[code]
@Override
  public boolean isMappingMode(final ClassMetaData meta) {
    return 
      this.isMappingMode() && 
      (meta.getSourceMode() & MetaDataModes.MODE_MAPPING) != 0 &&
      (meta.getEmbeddingMetaData() == null || this.isMappingMode(meta.getEmbeddingMetaData()));
  }
[/code]
  
> 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.