[hibernate-issues] [Hibernate-JIRA] Commented: (JPA-16) duplicated id column when abstract id methods are defined in a @MappedSuperclass
Constantino Cronemberger (JIRA)
noreply at atlassian.com
Thu Jun 16 12:24:24 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/JPA-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42612#action_42612 ]
Constantino Cronemberger commented on JPA-16:
---------------------------------------------
The workaround is simple: create a super class (not annotated with @MappedSuperclass) for BaseEntity and move the declaration of the abstract methods to this class.
> duplicated id column when abstract id methods are defined in a @MappedSuperclass
> --------------------------------------------------------------------------------
>
> Key: JPA-16
> URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-16
> Project: Java Persistence API
> Issue Type: Bug
> Environment: Database H2, Hibernate 3.6.4.Final
> Reporter: Constantino Cronemberger
> Priority: Minor
>
> The following classes:
> @MappedSuperclass
> public abstract class BaseEntity {
> public abstract Long getId();
> public abstract void setId(Long id);
> }
> @Entity
> @Table(name="STCB")
> public class SimpleTestClassB extends BaseEntity {
>
> private Long primaryKey;
>
> @Override
> @Id
> @Column(nullable = false, precision = 10, name = "sb_id")
> public Long getId() {
> return primaryKey;
> }
> @Override
> public void setId(Long primaryKey) {
> this.primaryKey = primaryKey;
> }
> }
> will generate the following table:
> create table STCB (sb_id number(19,0) not null, id number(19,0), primary key (sb_id));
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list