facebook

Scaffolding and primary keys of type long

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #309713 Reply

    Pat Moss
    Member

    Scoffolding friom java beans. Scaffolding adds a hash function to the beans (i.e., hashes the primary key). Looks like scaffolding is expecting primary key to be int.

    @Override
    public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + objId;
    return result;
    }

    In large applicaitons, I need to use primary keys of type long.

    Is this a limitation or am I doing something wrong?

    #309747 Reply

    Heflin Hogan
    Member

    You can set your primary key to whatever type you like, the hashCode method will always return int. It won’t have any effect on your application.

    Heflin Hogan

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Scaffolding and primary keys of type long

You must be logged in to post in the forum log in