[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-742?page=co...
]
Hardy Ferentschik commented on ANN-742:
---------------------------------------
As far as I can see buildJoinColumn() is called twice to construct the column instances
for person_id and address_id. No special care is taken here about a 'nullability'.
This mean that the default value true from Ejb3Column applies. Later
Configuration.generateSchemaCreationScript() and Table.sqlCreateString() get called. The
latter contains the following lines:
if ( col.isNullable() ) {
buf.append( dialect.getNullColumnString() );
}
else {
buf.append( " not null" );
}
Seems that in order to get a 'not null' the dialect does not play a role. It is
just important whether the column instance is nullable. Not sure if I am missing
something.
Primary key should not be set on nullable column
------------------------------------------------
Key: ANN-742
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-742
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.3.1.GA
Environment: hibernate core 3.2.6.GA
Reporter: Miroslav Havram
Assignee: Hardy Ferentschik
Fix For: 3.4.0.CR2
Attachments: create_scripts.zip, test_case.zip
After switching to hibernate-annotations 3.3.1.GA, DDL generated for intermediate table
for optional one-to-one association tries to set
primary key on nullable column. Problem is that some DBMSs (e.g. MS SQL) do not allow
that.
Using hibernate-annotations-3.3.0.GA:
create table personAddress (address_id bigint not null, person_id bigint not null,
primary key (person_id))
Using hibernate-annotations-3.3.1.GA:
create table personAddress (person_id bigint, address_id bigint, primary key
(person_id))
Simple test case and generated DDLs are attached.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira