私はそれらの間に関係を持つ2つのエンティティを持っています。これが私の最初のエンティティです:
@Entity
@Table(name = "APPLICATION_DEVICE")
public class ApplicationDevice implements Serializable {
[...]
@Id
@ManyToOne
@JoinColumn(name = "udid", nullable=false)
public Device getDevice()
{
return device;
}
public void setDevice(Device device)
{
this.device = device;
}
@Id
public Long getApplicationId()
{
return applicationId;
}
public void setApplicationId(Long applicationId)
{
this.applicationId = applicationId;
}
[...]
applicationIdとdevice(別の関係として)の2つのフィールドを持つ入門キーがあることに注意してください。
そして私の他の実体は:
@Entity
@Table(name = "SEGMENT_APPLICATION_DEVICES")
public class SegmentApplicationDevice
{
[...]
@Id
@GeneratedValue
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
@ManyToOne
public ApplicationDevice getApplicationDevice()
{
return applicationDevice;
}
public void setApplicationDevice(ApplicationDevice applicationDevice)
{
this.applicationDevice = applicationDevice;
}
[...]
そして、このエンティティをマッピングしようとするときの休止状態の例外は次のとおりです。
Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger, List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service 'HibernateSessionSource'): Foreign key (FK5B8CB9821C11FEAE:SEGMENT_APPLICATION_DEVICES [applicationDevice_applicationId])) must have same number of columns as the referenced primary key (APPLICATION_DEVICE [udid,applicationId])
私は何が間違っているのですか?ありがとう!