We are trying to upgrade hibernate from version 4.3.5 to 5.4.0. With this the jpa version also changes from hibernate-jpa-2.1 to jpa-2.2. After the upgrade we get the following error when using the List<> collection with @OrderColumn
"javax.persistence.PersistenceException: org.hibernate.HibernateException: null index column for collection" It is a unidirectional one-to-mapping with following annotations @Entity@Table(name = "DS_GENERIC")@PrimaryKeyJoinColumn(name = "DSG_DS_ID")public class GenericConnection extends DataSourceConnection { @OneToMany(cascade = ALL, orphanRemoval = true, fetch = FetchType.EAGER) @JoinColumn(name = "DSC_DS_ID", nullable = false) @OrderColumn(name = "DSC_ORDER", updatable = false, insertable = false) List<Credentials> credentials = new ArrayList<>(); } @Entity@Table(name = "DS_CREDENTIALS")public class Credentials { @Id @GeneratedValue(generator = "uid-generator") @Column(name = "DSC_ID", updatable = false) private Long id; //...} The below test code fails //construct the connection object with credentials entityManager.persist(connection); entityManager.find(DataSourceConnection.class, id); //this call fails with the above error Note that this code worked fine with hibernate 4.3.5 and one workaround that also works is converting List to Set as below @OneToMany(cascade = ALL, orphanRemoval = true, fetch = FetchType.EAGER)@JoinColumn(name = "DSC_DS_ID", nullable = false)@OrderBy("DSC_ID")Set<Credentials> credentials = new HashSet<>(); I do not understand the root cause of this failure. Any inputs would be appreciated. Thanks. P.S - I have posted this query on stackoverflow too <https://stackoverflow.com/questions/54686603/upgrading-hibernate-causes-null-index-column-for-collection-error-for-list> _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev