Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-768

Cached new entity has different primary key type to stored/loaded entity.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.0 branch
    • 3.0
    • Core Library
    • None
    • Arch Linux, Jetty 6.0.2, MySQL 5.0

    Description

      Entities mapped with a primary key type of BIGINT seem to have different types depending on whether the entity was newly-created (through DataContext.newObject) or loaded from a database through some query. In my experience, the primary key type (when looked up using DataObjectUtils.pkForObject) of a newly-created entity is java.lang.Integer, where as the primary key type of entities loaded from a database is java.lang.Long.

      I've (temporarily?) fixed the problem in my application by just treating all entity primary keys as Objects, as I suspect there might be a good reason for this behaviour that I don't understand yet.

      Attachments

        Activity

          People

            andrus Andrus Adamchik
            fuzelogik Chris Davies
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: