[ROO-3279] Hibernate startup fails when JoinColumns has multiple JoinColumn with distinct nullable attribute values Created: 18/Sep/12  Updated: 02/Oct/12  Resolved: 02/Oct/12

Status: Resolved
Project: Spring Roo
Component/s: @ CORE, PERSISTENCE
Affects Version/s: 1.2.2.RELEASE
Fix Version/s: 1.2.3.RELEASE

Type: Bug Priority: Major
Reporter: Mario Martínez Sánchez - gvNIX - DISID Assignee: Alan Stewart
Resolution: Complete Votes: 0
Labels: jpa, roo
Remaining Estimate: 1h
Time Spent: Not Specified
Original Estimate: 1h
Environment:

Ubuntu 12.04, JDK 1.0.6_33, maven 3.0.4, Oracle 10.0.4.0


Attachments: File patch.diff    

 Description   

Hibernate fails on startup:

org.hibernate.AnnotationException: Mixing nullable and non nullable columns in a property is not allowed: es.gva.cit.aplusu.domain.aum.TaumAplusu.taumAplusu

When database reverse engineer generate JoinColumns annotation with multiple JoinColumn annotations and nullable attribute of some JoinColumn has distinct value that the rest:

@ManyToOne
@JoinColumns({ 
@JoinColumn(name = "APLICACION", referencedColumnName = "APLICACION", nullable = false, insertable = false, updatable = false), @JoinColumn(name = "ROLUSUAR", referencedColumnName = "USUARIO", insertable = false, updatable = false)
})

All nullable attribute values should have same value (true or false).

If all false or all true, there is no problem.

But if mixing values set true for all.
This configuration is less restrictive and should work with all others ORMs.

I attach a patch with the diff.



 Comments   
Comment by Alan Stewart [ 02/Oct/12 ]

Applied patch in Git ID f54d05d9bd0f64697b5c31f54996434943bf2a5e. Please test and verify

Comment by Mario Martínez Sánchez - gvNIX - DISID [ 02/Oct/12 ]

Verified, regards Alan

Generated at Wed Dec 11 08:46:14 UTC 2019 using Jira 7.13.8#713008-sha1:1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6.