facebook

whats the advantage of unique="true" in mapping fi

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #224519 Reply

    gemino
    Member

    when i generate the mapping files and some of my attributes in the database are unique there is no unique=”true” attribute set in the mapping files. i think it works also without this flag, but whats the advantage of setting this optionally as menshioned in the hibernate docs?

    the code looks like this:

    <property name="serialNumber" unique="true" type="java.lang.String" column="SERIAL_NUMBER"/>

    is it better than this:

    <property name="serialNumber" type="java.lang.String" column="SERIAL_NUMBER"/>

    if there the serialNumber is already set unique in the database itself?

    #224521 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev, this is a hibernate question.

    AFAIK this just allows Hibernate to do some more strict checking for you and possibly optimize the use of the this unique object. I think along the lines of how not-null works as well.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: whats the advantage of unique="true" in mapping fi

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