Yes I am using Hibernate 6.0. I try to switch from Hibernate 6.0.0.Alpha6 to newer version Hibernate 6.0.0. Alpha9, an error related to foreign key still occurs:
Caused by: org.hibernate.NotYetImplementedFor6Exception: Support for non-pk foreign-keys not yet implemented: com.spf.ibigtime.entities.Babanktransferdetail -> budgetDetailItemCode
at org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper.interpretToOneKeyDescriptor(MappingModelCreationHelper.java:1039)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper.setReferencedAttributeForeignKeyDescriptor(MappingModelCreationHelper.java:1249)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper.interpretPluralAttributeMappingKeyDescriptor(MappingModelCreationHelper.java:903)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper.lambda$buildPluralAttributeMapping$8(MappingModelCreationHelper.java:873)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess$PostInitCallbackEntry.process(MappingModelCreationProcess.java:205)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess$PostInitCallbackEntry.access$000(MappingModelCreationProcess.java:191)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess.executePostInitCallbacks(MappingModelCreationProcess.java:108)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess.execute(MappingModelCreationProcess.java:90)
at org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess.process(MappingModelCreationProcess.java:39)
at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.finishInitialization(MappingMetamodelImpl.java:217)
at org.hibernate.metamodel.internal.RuntimeMetamodelsImpl.finishInitialization(RuntimeMetamodelsImpl.java:47)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:312)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1420)
... 111 more
Below are my entities:
Babanktransferdetail.java
@Entity
@Table(name = "babanktransferdetail")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Babanktransferdetail.findAll", query = "SELECT b FROM Babanktransferdetail b"),
@NamedQuery(name = "Babanktransferdetail.findByRefDetailID", query = "SELECT b FROM Babanktransferdetail b WHERE b.refDetailID = :refDetailID"),
@NamedQuery(name = "Babanktransferdetail.findByDescription", query = "SELECT b FROM Babanktransferdetail b WHERE b.description = :description"),
@NamedQuery(name = "Babanktransferdetail.findByDebitAccount", query = "SELECT b FROM Babanktransferdetail b WHERE b.debitAccount = :debitAccount"),
@NamedQuery(name = "Babanktransferdetail.findByCreditAccount", query = "SELECT b FROM Babanktransferdetail b WHERE b.creditAccount = :creditAccount"),
@NamedQuery(name = "Babanktransferdetail.findByFromBankID", query = "SELECT b FROM Babanktransferdetail b WHERE b.fromBankID = :fromBankID"),
@NamedQuery(name = "Babanktransferdetail.findByToBankID", query = "SELECT b FROM Babanktransferdetail b WHERE b.toBankID = :toBankID"),
@NamedQuery(name = "Babanktransferdetail.findByAmount", query = "SELECT b FROM Babanktransferdetail b WHERE b.amount = :amount"),
@NamedQuery(name = "Babanktransferdetail.findByBudgetSourceID", query = "SELECT b FROM Babanktransferdetail b WHERE b.budgetSourceID = :budgetSourceID"),
@NamedQuery(name = "Babanktransferdetail.findByBudgetChapterCode", query = "SELECT b FROM Babanktransferdetail b WHERE b.budgetChapterCode = :budgetChapterCode"),
@NamedQuery(name = "Babanktransferdetail.findByBudgetKindItemCode", query = "SELECT b FROM Babanktransferdetail b WHERE b.budgetKindItemCode = :budgetKindItemCode"),
@NamedQuery(name = "Babanktransferdetail.findByBudgetSubKindItemCode", query = "SELECT b FROM Babanktransferdetail b WHERE b.budgetSubKindItemCode = :budgetSubKindItemCode"),
@NamedQuery(name = "Babanktransferdetail.findByBudgetItemCode", query = "SELECT b FROM Babanktransferdetail b WHERE b.budgetItemCode = :budgetItemCode"),
@NamedQuery(name = "Babanktransferdetail.findByBudgetSubItemCode", query = "SELECT b FROM Babanktransferdetail b WHERE b.budgetSubItemCode = :budgetSubItemCode"),
@NamedQuery(name = "Babanktransferdetail.findByMethodDistributeID", query = "SELECT b FROM Babanktransferdetail b WHERE b.methodDistributeID = :methodDistributeID"),
@NamedQuery(name = "Babanktransferdetail.findByCashWithDrawTypeID", query = "SELECT b FROM Babanktransferdetail b WHERE b.cashWithDrawTypeID = :cashWithDrawTypeID"),
@NamedQuery(name = "Babanktransferdetail.findByAccountingObjectID", query = "SELECT b FROM Babanktransferdetail b WHERE b.accountingObjectID = :accountingObjectID"),
@NamedQuery(name = "Babanktransferdetail.findByActivityID", query = "SELECT b FROM Babanktransferdetail b WHERE b.activityID = :activityID"),
@NamedQuery(name = "Babanktransferdetail.findByProjectID", query = "SELECT b FROM Babanktransferdetail b WHERE b.projectID = :projectID"),
@NamedQuery(name = "Babanktransferdetail.findByProjectActivityID", query = "SELECT b FROM Babanktransferdetail b WHERE b.projectActivityID = :projectActivityID"),
@NamedQuery(name = "Babanktransferdetail.findByListItemID", query = "SELECT b FROM Babanktransferdetail b WHERE b.listItemID = :listItemID"),
@NamedQuery(name = "Babanktransferdetail.findBySortOrder", query = "SELECT b FROM Babanktransferdetail b WHERE b.sortOrder = :sortOrder"),
@NamedQuery(name = "Babanktransferdetail.findByAmountOC", query = "SELECT b FROM Babanktransferdetail b WHERE b.amountOC = :amountOC"),
@NamedQuery(name = "Babanktransferdetail.findByBudgetExpenseID", query = "SELECT b FROM Babanktransferdetail b WHERE b.budgetExpenseID = :budgetExpenseID")})
public class Babanktransferdetail implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 64)
@Column(name = "RefDetailID")
private String refDetailID;
......
@JoinColumn(name = "BudgetDetailItemCode", referencedColumnName = "BudgetItemCode")
@ManyToOne
private Budgetitem budgetDetailItemCode;
@JoinColumn(name = "FundStructureID", referencedColumnName = "FundStructureID")
@ManyToOne(optional = false)
private Fundstructure fundStructureID;
@JoinColumn(name = "ProjectActivityEAID", referencedColumnName = "ProjectID")
@ManyToOne(optional = false)
private Project projectActivityEAID;
........
Budgetitem.java
@Entity
@Table(name = "budgetitem")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Budgetitem.findAll", query = "SELECT b FROM Budgetitem b"),
@NamedQuery(name = "Budgetitem.findByBudgetItemID", query = "SELECT b FROM Budgetitem b WHERE b.budgetItemID = :budgetItemID"),
@NamedQuery(name = "Budgetitem.findByParentID", query = "SELECT b FROM Budgetitem b WHERE b.parentID = :parentID"),
@NamedQuery(name = "Budgetitem.findByBudgetItemType", query = "SELECT b FROM Budgetitem b WHERE b.budgetItemType = :budgetItemType"),
@NamedQuery(name = "Budgetitem.findByBudgetItemCode", query = "SELECT b FROM Budgetitem b WHERE b.budgetItemCode = :budgetItemCode"),
@NamedQuery(name = "Budgetitem.findByBudgetItemName", query = "SELECT b FROM Budgetitem b WHERE b.budgetItemName = :budgetItemName"),
@NamedQuery(name = "Budgetitem.findByBudgetGroupItemCode", query = "SELECT b FROM Budgetitem b WHERE b.budgetGroupItemCode = :budgetGroupItemCode"),
@NamedQuery(name = "Budgetitem.findByGrade", query = "SELECT b FROM Budgetitem b WHERE b.grade = :grade"),
@NamedQuery(name = "Budgetitem.findByIsParent", query = "SELECT b FROM Budgetitem b WHERE b.isParent = :isParent"),
@NamedQuery(name = "Budgetitem.findByIsActive", query = "SELECT b FROM Budgetitem b WHERE b.isActive = :isActive")})
public class Budgetitem implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 64)
@Column(name = "BudgetItemID")
private String budgetItemID;
@Size(max = 64)
@Column(name = "ParentID")
private String parentID;
@Basic(optional = false)
@NotNull
@Column(name = "BudgetItemType")
private int budgetItemType;
@Size(max = 20)
@Column(name = "BudgetItemCode")
private String budgetItemCode;
........
I also tried the 5.5.7 Final release, but nothing works.