[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6934) optional=false add an unexpected unique constraint

Lorber Sebastien (JIRA) noreply at atlassian.com
Tue Jan 3 05:56:22 EST 2012


optional=false add an unexpected unique constraint
--------------------------------------------------

                 Key: HHH-6934
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6934
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.4
         Environment: Oracle 10g, Hibernate 3.6.4, Hbm2ddl, H2...
            Reporter: Lorber Sebastien
            Priority: Minor


I have a very simple OneToOne relationship:

    @OneToOne(optional = false,orphanRemoval = false)
    @JoinColumn (name="leadform_id",unique=false)
    public Leadform getLeadform() {
        return leadform;
    }


When using optional = false
I get in my hbm2ddl schema: unique (leadform_id)

When using optional = true, i don't have that unique constraint.



Documentation says:
"If set to false then a non-null relationship must always exist."
And in my case it does, but the documentation doesn't say this optional attribute has any effect on the unique constraint.

Actually i think everybody expect that constraint to be handled by the JoinColumn unique=false attribute, or at least to find the information in the documentation.



It affects hbm2ddl when using the maven hibernate3:hbm2ddl goal but also when hibernate creates the test tables in H2

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list