openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maia Kozheva (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-1059) Unnecessary creation of OPENJPA_SEQUENCE_TABLE for embeddable classes
Date Wed, 18 May 2011 04:55:47 GMT

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

Maia Kozheva commented on OPENJPA-1059:
---------------------------------------

Still present in 2.1.0.

> Unnecessary creation of OPENJPA_SEQUENCE_TABLE for embeddable classes
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-1059
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1059
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.1, 2.0.0-M2
>            Reporter: Martin Dirichs
>            Priority: Minor
>
> Using OpenJPA with all identity values generated by the datastore does not
> trigger the creation of OPENJPA_SEQUENCE_TABLE. However, as soon as a
> embeddable class is used, this table is being created although embeddable
> classes do not have a persistent identity on their own.
> Example
> =======
> MainEntity.java:
> import javax.persistence.*;
> @Entity
> public class MainEntity {
>     @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
>     int id;
>     @Embedded
>     EmbeddedClass e; // Referencing the embedded class yields the bug
> }
> EmbeddedClass:
> import javax.persistence.*;
> @Embeddable
> public class EmbeddedClass {
>     String someValue;
> }
> META-INF/persistence.xml:
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     version="1.0">
>     <persistence-unit name="showcase">
>         <class>MainEntity</class>
>         <class>EmbeddedClass</class>
>     </persistence-unit>
> </persistence>
> Running org.apache.openjpa.jdbc.meta.MappingTool for the above
> two classes results in the creation of OPENJPA_SEQUENCE_TABLE.
> This is not the case if the reference to the embedded class is removed
> from MainEntity.
> According to Micheal Dick, there might be some use case where this
> behaviour is desired. However, since the sequence table is used to
> generate id values and embeddable classes have no id fields at all,
> it seems more likely to be a bug. See here for the mailing list discussion:
> http://n2.nabble.com/OPENJPA_SEQUENCE_TABLE-created-unnecessarily-for-embeddable-classes-tc2787226.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message