facebook

Bug in postgres hibernate mapping files

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #230357 Reply

    Werner Punz
    Member

    There is a small bug in the postgres hibernate mapping files.
    Postgres relies on sequences which it sort of auto generates for the indexes.
    You can chose sequence as primary key datatype in myeclipse, but the generated code is not fully correct, it is missing the entry to the sequence.
    IE:
    <id name=”id” column=”id” type=”java.lang.Integer”>
    <generator class=”sequence”/>
    </id>
    is generated while the correct entry would be:
    <id name=”id” column=”id” type=”java.lang.Integer”>
    <generator class=”sequence”>
    <param name=”sequence”>master_id_seq</param>
    </generator>
    </id>
    with master being the table name.

    #230380

    Riyad Kalla
    Member

    werpu,
    If your DB is auto generating the keys, then you want your key type to be native, not sequence IIRC.

    #230404

    Werner Punz
    Member

    Ok thanks… I also found a relevant entry in the hibernate forums regarding a similar problem (with the native files) the official way really is to go with native as key type in case of having the database handle the id generation, instead of using the generation type in the key entry of the hibernate configuration.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Bug in postgres hibernate mapping files

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