You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "wilesun (JIRA)" <ji...@apache.org> on 2008/08/09 13:46:44 UTC

[jira] Created: (OPENJPA-689) @ID define in super class

@ID define in super class
-------------------------

                 Key: OPENJPA-689
                 URL: https://issues.apache.org/jira/browse/OPENJPA-689
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.1.0
            Reporter: wilesun
             Fix For: 1.1.1


our entities have share super class,the class has one field define the entity id,so we define the class as mappedsuperclass
when we work with hibernate JPA,it work fine.
but migrate to openjpa,the PCEnhancer don't assign other entity has ID class,so the query sql is incorrect.
example:
@MappedSuperclass
public EntityBase {
    @Id
    @Column(name="ID")
    private String id;
}

@Entity
public B extends EntityBase {

}

@Entity
public C extends EntityBase {

}

Object o = em.find(B.class, "111");
the sql list:
select * from A where id=?
select * from B where id=?

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


[jira] Updated: (OPENJPA-689) @ID define in super class

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

wilesun updated OPENJPA-689:
----------------------------

    Fix Version/s:     (was: 1.1.1)
                   1.3.0

> @ID define in super class
> -------------------------
>
>                 Key: OPENJPA-689
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-689
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.1.0
>            Reporter: wilesun
>             Fix For: 1.3.0
>
>
> our entities have share super class,the class has one field define the entity id,so we define the class as mappedsuperclass
> when we work with hibernate JPA,it work fine.
> but migrate to openjpa,the PCEnhancer don't assign other entity has ID class,so the query sql is incorrect.
> example:
> @MappedSuperclass
> public EntityBase {
>     @Id
>     @Column(name="ID")
>     private String id;
> }
> @Entity
> public B extends EntityBase {
> }
> @Entity
> public C extends EntityBase {
> }
> Object o = em.find(B.class, "111");
> the sql list:
> select * from A where id=?
> select * from B where id=?

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


[jira] Commented: (OPENJPA-689) @ID define in super class

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12621302#action_12621302 ] 

Pinaki Poddar commented on OPENJPA-689:
---------------------------------------

Description of this issue is not clear enough.
Can you please elaborate further what is the problem being encountered when entities inherit from a @MappedSuperclass?
 
It may be worthwhile to discuss any potential issue in the OpenJPA user group before creating a JIRA issue.


> @ID define in super class
> -------------------------
>
>                 Key: OPENJPA-689
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-689
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.1.0
>            Reporter: wilesun
>             Fix For: 1.1.1
>
>
> our entities have share super class,the class has one field define the entity id,so we define the class as mappedsuperclass
> when we work with hibernate JPA,it work fine.
> but migrate to openjpa,the PCEnhancer don't assign other entity has ID class,so the query sql is incorrect.
> example:
> @MappedSuperclass
> public EntityBase {
>     @Id
>     @Column(name="ID")
>     private String id;
> }
> @Entity
> public B extends EntityBase {
> }
> @Entity
> public C extends EntityBase {
> }
> Object o = em.find(B.class, "111");
> the sql list:
> select * from A where id=?
> select * from B where id=?

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


[jira] Commented: (OPENJPA-689) @ID define in super class

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

Fernando commented on OPENJPA-689:
----------------------------------

I am doing this right now.  Did you add the EntityBase to the persistence.xml classes list?  Since it has to enhance the mappedSuperclass too.

> @ID define in super class
> -------------------------
>
>                 Key: OPENJPA-689
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-689
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.1.0
>            Reporter: wilesun
>             Fix For: 1.3.0
>
>
> our entities have share super class,the class has one field define the entity id,so we define the class as mappedsuperclass
> when we work with hibernate JPA,it work fine.
> but migrate to openjpa,the PCEnhancer don't assign other entity has ID class,so the query sql is incorrect.
> example:
> @MappedSuperclass
> public EntityBase {
>     @Id
>     @Column(name="ID")
>     private String id;
> }
> @Entity
> public B extends EntityBase {
> }
> @Entity
> public C extends EntityBase {
> }
> Object o = em.find(B.class, "111");
> the sql list:
> select * from A where id=?
> select * from B where id=?

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