[
https://issues.apache.org/jira/browse/OPENJPA-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13231521#comment-13231521
]
Caspar MacRae commented on OPENJPA-1059:
----------------------------------------
Erm, I don't think this is a minor bug - I've just spent most of today trying
to work round this, and now in anger and frustration I will have to look at
different JPA implementation.
This bug renders OpenJPA unusable for me (which is a shame as this is a nice
project).
It's nearly three years old, and at least in my case it's major - please fix
this.
> 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, 2.1.0
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira