Since one of the newer releases of the JBPM was added an indexes internal classes:
@Entity
@Table(name="Attachment",
indexes = {@Index(name = "IDX_Attachment_Id",
columnList="attachedBy_id"),
@Index(name = "IDX_Attachment_DataId",
columnList="TaskData_Attachments_Id")})
@SequenceGenerator(name="attachmentIdSeq",
sequenceName="ATTACHMENT_ID_SEQ", allocationSize=1)
public class AttachmentImpl implements InternalAttachment {
...
@ManyToOne()
private UserImpl attachedBy;
...
}
attachedBy_id column from the index columnList named attached_by_id in the database. Hibernate cannot recognize correct physical column name and throws an exception:
org.hibernate.AnnotationException: Unable to create unique key constraint (attachedBy_id) on table attachment: database column 'attachedBy_id' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)
I can't change the code of the JBPM. I don't want to change the column name in the database as well (it doesn't help anyway), but I need to map attachedBy_id from @Index columnList to attached_by_id in some way. Is it possible to apply the same naming strategy to the index columnList?