You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "chunlinyao (JIRA)" <ji...@apache.org> on 2012/11/04 06:27:13 UTC

[jira] [Created] (OPENJPA-2290) merge new entity will search DB with 0 entity id.

chunlinyao created OPENJPA-2290:
-----------------------------------

             Summary: merge new entity will search DB with 0 entity id.
                 Key: OPENJPA-2290
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2290
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 2.2.0
            Reporter: chunlinyao
            Priority: Minor


I have a entity with Long id. When I merge a new entity. OpenJPA always query db with id = 0.
The new entity's id == null, Why it query the db and translate the null to 0?

The ApplicationIds.create() returns 0 LongId on a pc with null id. This cause openjpa query db with 0 id. When there have a id==0 entity in the db you will have some trouble.

If I use GenerateType.IDENTITY with hsqldb, the id will generated start from 0. So If I run merge(new Entity()) two times, I only got one entity.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira